In the following procedure, a user changes permissions on a file that the user owns.
% chmod nnn filename
Specifies the octal values that represent the permissions for the file owner, file group, and others, in that order. For the list of valid octal values, see Figure 4, Table 4, Setting File Permissions in Absolute Mode.
Specifies the file or directory.
% ls -l filename
In the following example, the administrator changes the permissions of a directory that is open to the public from 744 (read, write, execute; read-only; and read-only) to 755 (read, write, execute; read and execute; and read and execute).
# ls -ld public_dir drwxr--r-- 1 jdoe staff 6023 Aug 5 12:06 public_dir # chmod 755 public_dir # ls -ld public_dir drwxr-xr-x 1 jdoe staff 6023 Aug 5 12:06 public_dir
In the following example, the file owner changes the permissions of an executable shell script from read and write to read, write, and execute.
% ls -l my_script -rw------- 1 jdoe staff 6023 Aug 5 12:06 my_script % chmod 700 my_script % ls -l my_script -rwx------ 1 jdoe staff 6023 Aug 5 12:06 my_script