[BLUG] scp -p preserving ownership through root user

Brian Wheeler bdwheele at indiana.edu
Wed Jul 2 12:01:05 EDT 2008


On Wed, 2008-07-02 at 11:57 -0400, Shei, Shing-Shong wrote:
> This is because the files on machine A is created by root, the user who
> is running the scp.  If you want to preserve all information, you need
> to use tar:
> 
> ssh machineB -n tar cCf /path/to/file - . | tar xf -
> 
> (Or you have to 'su X' on machine A before you do the scp.)
> 

True, but you have to make sure that the passwd/group file is in sync
for all of the files or there'll be weirdness unless you use
--numeric-owner.

That one bit me when I was using a rescue disk and copying one machine
to another...

Brian


> Shing-Shong
> 
> Mark Krenz wrote:
> > I have some files that are owned on machine A by user X.   As the root
> > user on machine A, I run
> >
> >   scp -p files root at machineB
> >
> >   The mode and modification times are preserved, but the ownership is
> > not. I know that with rsync -a the ownership is preserved, but
> > according ot the scp man page, ownership isn't preserved with -p.  I
> > just got burned by this.  Tell me if I'm insane or not but I could swear
> > that this worked before.  It might have had this in a much older version
> > of scp, like the old non-openssh version of ssh.
> >
> > Know your options.
> >
> >   
> _______________________________________________
> BLUG mailing list
> BLUG at linuxfan.com
> http://mailman.cs.indiana.edu/mailman/listinfo/blug



More information about the BLUG mailing list