
The following example sets sticky bit permission on the pubdir directory. The following example sets setgid permission on the dbprog2 file. The following example sets setuid permission on the dbprog file. See Table 17-6įor the list of valid octal values for the special permissions.Įxamples-Setting Special Permissions in Absolute Mode The first octal value on the left sets the special permissions on the file. Specifies the octal values that change the permissions on the file or directory. Only the current owner or superuser can use the chmod command to change the special permissions on a file or directory.Ĭhange special permissions in absolute mode by using the chmod command.
Chmod readwrite how to#
How to Change Special Permissions in Absolute Mode rwx- 1 ignatz staff 6023 Aug 5 12:06 my_script rw- 1 ignatz staff 6023 Aug 5 12:06 my_script The following example shows changing the permissions of an executable shell script from read/write to read/write/execute. The following example shows changing the permissions of a public directory from 744 (read/write/execute, read-only, and read-only) to 755 (read/write/execute, read/execute, and read/execute).ĭrwxr-r- 1 ignatz staff 6023 Aug 5 12:06 public_dirĭrwxr-xr-x 1 ignatz staff 6023 Aug 5 12:06 public_dir Verify the permissions of the file have changed.Įxample-Changing Permissions in Absolute Mode Use the getfacl(1) command to make sure the appropriate permissions are set for all ACL entries. Be aware that the new ACL mask permissions can change the effective permissions for additional users and groups 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. Specifies the octal values that represent the permissions for the file owner, file group, and others, in that order. Only the current owner or superuser can use the chmod command to change file permissions on a file or directory.Ĭhange permissions in absolute mode by using the chmod command. If you are not the owner of the file or directory, become superuser. How to Change Permissions in Absolute Mode The who operator permission designations in the function column specifies the symbols that change the permissions on the file or directory. Sticky bit is on, execution bit for others is off Sticky bit is on, execution bit for others is on Suid bit is on, user execution bit is off Mandatory locking, setgid bit is on, group execution bit is off Table 17-7 Setting File Permissions in Symbolic Mode

Symbols can specify whose permissions are to be set or changed, the operation to be performed, and the permissions being assigned or changed. The table below lists the symbols for setting file permissions in symbolic mode. Table 17-6 Setting Special Permissions in Absolute Mode The table below lists the octal values to set special permissions on a file. In absolute mode, you set special permissions by adding a new octal value to the left of the permission triplet. You can set special permissions on a file in absolute or symbolic modes. Table 17-5 Setting File Permissions in Absolute Mode For example, the value 644 sets read/write permissions for owner, and read-only permissions for group and other. You use these numbers in sets of three to set permissions for owner, group, and other (in that order). The table below lists the octal values for setting file permissions in absolute mode. Symbolic Mode - Use combinations of letters and symbols to add or remove permissions. When you change permissions by using the absolute mode, represent permissions for each triplet by an octal mode number.


You can use the chmod command to set permissions in either of two modes:Ībsolute Mode - Use numbers to represent file permissions (the method most commonly used to set permissions). You must be superuser or the owner of a file or directory to change its permissions. The chmod command enables you to change the permissions on a file.
