chmod sftp command and setgid/setuid bit

Eric Noulard eric.noulard at gmail.com
Wed Apr 25 08:30:21 EST 2007


Hi OpenSSH developers,

I'm using OpenSSH on a daily basis and I'm very pleased
with the work you've done.

I am contributing to some Open Source software hosted at Savannah
https://savannah.nongnu.org/projects/tsp
and we recently hit some sftp unexpected behavior:
https://savannah.gnu.org/support/?105838

when using chmod sftp client command
it appears that setuid / setgid bits are not handled on the server-side.

that when I

sftp> chmod 2775 afile

I would expect afile to show:
-rwxrwsr-x    1 openssh   isgreat    0 2007-04-25 00:19 afile

but I get:
-rwxrwxr-x    1 openssh   isgreat    0 2007-04-25 00:19 afile

just as if I had typed: "chmod 775 afile " on server-side.

As far as I understand sftp-server.c code is seems that

chmod(name, a->perm & 0777);

is responsible for this behavior.

Could you tell me if not handling setuid/setgid bits on sftp-server
is done on purpose?
Is it a feature or should it be considered a bug?

If it is a feature could you tell me what motivates this choice?

By the way "-p" option of scp command seems to handle setuid/setgid
bits as (I) expected.

Thanks in advance
-- 
Erk


More information about the openssh-unix-dev mailing list