Man pages says as much:

       chmod preserves a directory's set-user-ID and set-group-ID bits
unless you explicitly specify  other-
       wise.   You  can set or clear the bits with symbolic modes like
u+s and g-s, and you can set (but not
       clear) the bits with a numeric mode.
 

        From: [email protected]
[mailto:[email protected]] On Behalf Of Kyle O'Donnell
        Sent: Thursday, March 24, 2011 11:11 AM
        To: [email protected]
        Subject: [rhelv6-list] found a chmod bug in rhel 6.0
        
        
        I think I found a bug with chmod, but I could just be
misinformed...
        
        It looks like the numerical permission syntax for setuid/setgid
can only be unset with the alphabetical syntax on directories.
        
        755 permission set on at directory
        # ls -lad at
        drwxr-xr-x 2 root root 4096 Mar 24 11:35 at
        
        add setgid
        # chmod 2755 at
        # ls -lad at
        drwxr-sr-x 2 root root 4096 Mar 24 11:35 at
        
        attempt to remove setgid
        # chmod 0755 at
        # ls -lad at
        drwxr-sr-x 2 root root 4096 Mar 24 11:35 at
        didnt work
        
        another attempt to remove setgid
        # chmod 755 at
        # ls -lad at
        drwxr-sr-x 2 root root 4096 Mar 24 11:35 at
        also didn't work
        
        and one more
        # chmod g-s at
        # ls -lad at
        drwxr-xr-x 2 root root 4096 Mar 24 11:35 at
        success
        
        This doesn't appear to affect files only directories.
        
        
        --kyleo
        


This email communication and any files transmitted with it may contain 
confidential and or proprietary information and is provided for the use of the 
intended recipient only.  Any review, retransmission or dissemination of this 
information by anyone other than the intended recipient is prohibited.  If you 
receive this email in error, please contact the sender and delete this 
communication and any copies immediately.  Thank you.
http://www.encana.com


_______________________________________________
rhelv6-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv6-list

Reply via email to