Chmod Ulitlity

Grant values for permissions

4 read
2 write
1 execute

Order in which permissions are assigned

  owner        group         others
4 + 2 + 1    4 + 2 + 1    4 + 2 + 1
Add the numbers and use the sum with the chmod utlility.


Options

-f does not issue error messages concerning file access permissions, even if chmod encounters such errors
-R changes the access permissions of all files and subdirectories under a directory if one is specified as a path name on the command line


Example

chmod 711 koolfile
owner      group      others
    7              1               1
7 sets user permissions to 4 read + 2 write + 1 execute.
1 sets group permissions to 1 execute.
1 sets ohter permissions to 1 execute.


Example

chmod 765 koolfile
owner      group      others
    7              6               5
7 sets user permissions which are 4 read + 2 write + 1 execute.
6 sets group permission which is 4 read + 2 write.
5 sets other permissions, which is 4 read + 1 execute.


Another way to set unix permissions

u sets user (individual) permissions.
g sets group permissions.
o sets other permissions.
a sets all permissions. This is the default
r sets read permissions.
w sets write permissions.
x sets execute permissions.


Examples

chmod u+rwx koolfile
Sets the user permissions to read, write, and execute.
-rwx------ 1 group owner 124 Jun 5 13:28 koolfile


chmod g+rwx koolfile
chmod unix permissions utlitity. sets read write and execute permissions owner group other Sets the group permissions to read, write, and execute.
----rwx--- 1 group owner 124 Jun 5 13:28 koolfile
chmod o+rwx koolfile
Sets the other permissions to read, write, and execute.
-------rwx 1 group owner 124 Jun 5 13:28 koolfile
chmod a+rwx koolfile
Sets user, group and other permissions to read, write and execute.
-rwxrwxrwx 1 jgaren jgaren 124 Jun 5 13:28 new Examples To remove permissions
chmod u-rwx koolfile
Removes the user permissions read, write, and execute.

chmod g-rxw koolfile
Removes the group permissions read, write, and execute.

chmod o-rxw koolfile
Removes the other permissions read, write, and execute