Bug 1310

Summary: chmod sftp command and setgid/setuid bit
Product: Portable OpenSSH Reporter: Eric NOULARD <eric.noulard>
Component: sftp-serverAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: normal CC: djm, eric.noulard, p.r.gotch
Priority: P3    
Version: -current   
Hardware: All   
OS: Linux   
URL: http://marc.info/?t=117745570300006&r=1&w=4
Bug Depends on:    
Bug Blocks: 1452    

Description Eric NOULARD 2007-04-25 15:38:28 AEST
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.
Comment 1 Frederik Deweerdt 2007-04-26 18:33:08 AEST
Looks as the same bug as #1176
Comment 2 Frederik Deweerdt 2007-04-26 19:01:03 AEST
*** Bug 1176 has been marked as a duplicate of this bug. ***
Comment 3 Damien Miller 2008-06-12 18:19:37 AEST
I think we can make a decision one way or the other before the openssh-5.1 release, so put this bug on the tracking list.
Comment 4 Damien Miller 2008-06-26 16:11:15 AEST
The masking in sftp-server has been relaxed so it will be possible to explicitly set set[ug]id/sticky bits in OpenSSH 5.1. Thanks!
Comment 5 Damien Miller 2008-07-22 12:18:47 AEST
Mass update RESOLVED->CLOSED after release of openssh-5.1