[BLUG] scp -p preserving ownership through root user
Shei, Shing-Shong
shei at cs.indiana.edu
Wed Jul 2 11:57:48 EDT 2008
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.)
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.
>
>
More information about the BLUG
mailing list