scp bug: newly created dirs do not inherit sgid bit

Petr Skovron xofon at pikomat.mff.cuni.cz
Mon Oct 17 21:48:29 EST 2005


> 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/

     When scp copies a local file to local, ordinary cp is invoked (as
scp -v should show), see scp.c line +-462.

>   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.

     To recreate the relevant behaviour, use
scp -r localhost:bardir foodir
or
scp -r bardir localhost:foodir
(my system is linux debian 3.1 with kernel 2.4.30).

     When replying, please send me a Cc:, as I am not a member of the
list. Thanks.

> Bob

     Petr




More information about the openssh-unix-dev mailing list