System Administration Guide, Volume 2

How to Change Special Permissions in Absolute Mode

  1. If you are not the owner of the file or directory, become superuser.

    Only the current owner or superuser can use the chmod command to change the special permissions on a file or directory.

  2. Change special permissions in absolute mode by using the chmod command.


    $ chmod nnnn filename
    

    nnnn

    Specifies the octal values that change the permissions on the file or directory. The first octal value on the left sets the special permissions on the file. See Table 17-6 for the list of valid octal values for the special permissions.

    filename

    Specifies the file or directory. 


    Note -

    If you use chmod to change the file group permissions on a file with ACL entries, both the file group permissions and the ACL mask are changed to the new permissions. Be aware that the new ACL mask permissions can change the effective permissions for additional users and groups who have ACL entries on the file. Use the getfacl(1) command to make sure the appropriate permissions are set for all ACL entries.


  3. Verify the permissions of the file have changed.


    $ ls -l filename
    

Examples--Setting Special Permissions in Absolute Mode

The following example sets setuid permission on the dbprog file.


$ chmod 4555 dbprog
$ ls -l dbprog
-r-sr-xr-x   1 db     staff        12095 May  6 09:29 dbprog

The following example sets setgid permission on the dbprog2 file.


$ chmod 2551 dbprog2
$ ls -l dbprog2
-r-xr-s--x   1 db     staff       24576 May  6 09:30 dbprog2

The following example sets sticky bit permission on the pubdir directory.


$ chmod 1777 pubdir