If you are not the owner of the file or directory, become superuser or assume an equivalent role.
Only the current owner or superuser can use the chmod command to change file permissions on a file or directory.
Change permissions in symbolic mode.
% chmod who operator permissions filename |
Specifies whose permissions are to be changed.
Specifies the operation to be performed.
Specifies what permissions are to be changed. For the list of valid symbols, see Table 7–5.
Specifies the file or directory.
Verify that the permissions of the file have changed.
% ls -l filename |
In the following example, read permission is taken away from others.
% chmod o-r example-file1 |
In the following example, read and execute permissions are added for user, group, and others.
$ chmod a+rx example-file2 |
In the following example, read, write, and execute permissions are assigned to group.
$ chmod g=rwx example-file3 |