The permissions bits applied to a file system object correspond directly to the values which can be specified in the 4 digit tuple supplied to the chmod utility in the following command:
# chmod abcd [file system object]
Each value in the digit set abcd is made up of a sum of the values 1 2 and 4. By adding these values together for each digit, a value can be generated to set all file object attributes:
a – This digit controls special attribute settings. the value 1 sets the setuid bit, the value 2 sets the setgid bit, and the value 4 sets the sticky bit on the object.
b, c and d – These digits control read write and execute permissions for the file owner, the file owners primary group, and all other users. The value 4 enables read permission, the value 2 enables write permission, and the value 1 enables execute permission.
chmod -R 755
The -R option gives the permission recursively to all the files and folders under a directory. For example:
# chmod -R 755 /data01
The above command will recursively give 755 permission to /data01 directory along with all the files and directories present under it.
Other examples
1. To set a file file to be sticky, readable and writeable by the owner, readable by their primary group and inaccessible by everyone else:
# chmod 4610 filename
2. To give all permission to everyone on the system:
# chmod 0777 filename
For more information on chmod, see the chmod man page.
# man chmod