Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #239886

copy directory tree, mapping to new owners

From Richard Hector <richard@walnut.gen.nz>
Newsgroups linux.debian.user
Subject copy directory tree, mapping to new owners
Date 2021-09-12 02:50 +0200
Message-ID <CWlQZ-11P-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Hi all,

The context of my question is that I'm creating (or updating) a test 
copy of a website. The files are owned by one of two owners, depending 
on whether they were written by the server (actually php-fpm).

To do that, I want all the permissions to remain the same, but the 
ownership should be changed according to a provided map. For example, if 
the old file was owned by 'mysite', the copy should be owned by 
'mysite_test'. If the old file was owned by 'mysite-run' (the user php 
runs as), the copy should be owned by 'mysite_test-run' (if that has to 
be 'mysite-run_test' to make things easier, I can live with that).

Group ownership is or would be the same, but in fact it's simpler 
because both users are members of teh same group - all files are or 
should be group-owned by the same group (mysite, mapping to mysite_test).

Is there any pre-existing tool that will do this? Or will I need to 
write a perl script or similar?

What I've done in the past is use the same users for both production and 
testing, and do the copy by running rsync as the mysite user, but 
firstly I'd rather have more isolation between the two, secondly the 
mysite user might not be able to read all the mysite-run files, and 
thirdly the ownership of those (mysite-run) files gets changed, making 
it an imperfect copy.

Thanks in advance,
Richard

Back to linux.debian.user | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

copy directory tree, mapping to new owners Richard Hector <richard@walnut.gen.nz> - 2021-09-12 02:50 +0200
  Re: copy directory tree, mapping to new owners Greg Wooledge <greg@wooledge.org> - 2021-09-12 03:00 +0200
    Re: copy directory tree, mapping to new owners Richard Hector <richard@walnut.gen.nz> - 2021-09-12 03:50 +0200
      Re: copy directory tree, mapping to new owners john doe <johndoe65534@mail.com> - 2021-09-12 09:00 +0200
        Re: copy directory tree, mapping to new owners Andrei POPESCU <andreimpopescu@gmail.com> - 2021-09-12 12:30 +0200
        Re: copy directory tree, mapping to new owners Richard Hector <richard@walnut.gen.nz> - 2021-09-13 01:50 +0200
          Re: copy directory tree, mapping to new owners <tomas@tuxteam.de> - 2021-09-13 09:10 +0200
            Re: copy directory tree, mapping to new owners Richard Hector <richard@walnut.gen.nz> - 2021-09-14 08:20 +0200
              Re: copy directory tree, mapping to new owners <tomas@tuxteam.de> - 2021-09-14 09:00 +0200
                Re: copy directory tree, mapping to new owners David Wright <deblis@lionunicorn.co.uk> - 2021-09-14 15:50 +0200
                Re: copy directory tree, mapping to new owners Richard Hector <richard@walnut.gen.nz> - 2021-09-15 01:00 +0200
      Re: copy directory tree, mapping to new owners l0f4r0@tuta.io - 2021-09-12 09:00 +0200
        Re: copy directory tree, mapping to new owners Curt <curty@free.fr> - 2021-09-12 16:30 +0200
          Re: copy directory tree, mapping to new owners l0f4r0@tuta.io - 2021-09-12 18:40 +0200
        Re: copy directory tree, mapping to new owners Richard Hector <richard@walnut.gen.nz> - 2021-09-13 01:50 +0200
      Re: copy directory tree, mapping to new owners l0f4r0@tuta.io - 2021-09-12 09:20 +0200
  Re: copy directory tree, mapping to new owners Teemu Likonen <tlikonen@iki.fi> - 2021-09-12 09:50 +0200
    Re: copy directory tree, mapping to new owners <tomas@tuxteam.de> - 2021-09-12 10:10 +0200
    Re: copy directory tree, mapping to new owners Richard Hector <richard@walnut.gen.nz> - 2021-09-13 02:10 +0200

csiph-web