scp bug: newly created dirs do not inherit sgid bit
Bob Proulx
bob at proulx.com
Mon Oct 17 06:09:58 EST 2005
Petr Skovron wrote:
> Dear developers,
I am not an ssh developer but your issue interested me.
> I discovered that directories created by scp when recursive
> copying into a sgid directory do not inherit the sgid bit. I believe
> this is a bug. A patch to fix this is attached.
I was not able to recreate your issue on my GNU/Linux system.
Therefore I don't think I understand it fully. Could you create a
small test case that illustrates the problem? I tried the following.
mkdir foodir bardir
chgrp staff foodir
chmod g+ws foodir
touch bardir/bar
scp -r bardir foodir/
ls -ld foodir foodir/bardir foodir/bardir/bar
drwxrwsr-x 3 bob staff 72 2005-10-16 14:07 foodir
drwxr-sr-x 2 bob staff 72 2005-10-16 14:07 foodir/bardir
-rw-r--r-- 1 bob staff 0 2005-10-16 14:07 foodir/bardir/bar
On my system the sgid bit was inherited as I expected.
Are you using the 'scp -p' option? If so then the -p will explicitly
set the permissions of the newly created files to the mode in the
source. This will override the sgid directory behavior as expected.
Bob
More information about the openssh-unix-dev
mailing list