[PLUG] Re: sftp and scp - preserving UID/GID (2)

Fedor Pikus fpikus at gmail.com
Tue Dec 21 08:20:32 UTC 2004


On Mon, 20 Dec 2004 21:27:14 -0800, Keith Lofstrom <keithl at kl-ic.com> wrote:
> 
> Randall Lucas writes:
> > I believe scp -p preserves permissions.
> 
> Russell Senior writes:
> > Er, why not rsync?  See the --numeric-ids option.
> 
> Elliott Mitchell writes:
> > Likely you want the -p option to scp or -P for sftp get/put.
> 
> Indeed, -p preserves permissions, but it does NOT preserve numeric
> UID/GID .  The reason I am asking is for a by-hand "move files one
> by one" situation, where the rsync command line is too much typing.
I believe scp cannot do what you want. Check this bug report:
http://bugzilla.mindrot.org/show_bug.cgi?id=427

There is a proposed patch to preserve uid/gid but it's rejected.

I suspect that there may be security ramifications as well with root
blindly creating files owned by another user. Definitely so if
permissions are fully preserved, including the setuid bit, but may be
even without it.

Anyway, the best way to copy everything exactly as-is is to pipe tar
through ssh, this also copies links accurately.

-- 
Fedor G Pikus (fpikus at gmail.com)
http://www.pikus.net
http://wild-light.com



More information about the PLUG mailing list