coreutils: Changing Special Mode Bits

1 
1 27.2.3 Changing Special Mode Bits
1 ---------------------------------
1 
1 In addition to changing a file’s read, write, and execute/search
11 permissions, you can change its special mode bits.  ⇒Mode
 Structure, for a summary of these special mode bits.
1 
1    To change the file mode bits to set the user ID on execution, use ‘u’
1 in the USERS part of the symbolic mode and ‘s’ in the PERMISSIONS part.
1 
1    To change the file mode bits to set the group ID on execution, use
1 ‘g’ in the USERS part of the symbolic mode and ‘s’ in the PERMISSIONS
1 part.
1 
1    To set both user and group ID on execution, omit the USERS part of
1 the symbolic mode (or use ‘a’) and use ‘s’ in the PERMISSIONS part.
1 
1    To change the file mode bits to set the restricted deletion flag or
1 sticky bit, omit the USERS part of the symbolic mode (or use ‘a’) and
1 use ‘t’ in the PERMISSIONS part.
1 
1    For example, to set the set-user-ID mode bit of a program, you can
1 use the mode:
1 
1      u+s
1 
1    To remove both set-user-ID and set-group-ID mode bits from it, you
1 can use the mode:
1 
1      a-s
1 
1    To set the restricted deletion flag or sticky bit, you can use the
1 mode:
1 
1      +t
1 
1    The combination ‘o+s’ has no effect.  On GNU systems the combinations
1 ‘u+t’ and ‘g+t’ have no effect, and ‘o+t’ acts like plain ‘+t’.
1 
1    The ‘=’ operator is not very useful with special mode bits.  For
1 example, the mode:
1 
1      o=t
1 
1 does set the restricted deletion flag or sticky bit, but it also removes
1 all read, write, and execute/search permissions that users not in the
1 file’s group might have had for it.
1 
1    ⇒Directory Setuid and Setgid, for additional rules concerning
1 set-user-ID and set-group-ID bits and directories.
1