chmod Essentials

Linux Logo

Octal Permissions

OctalPermission
0
1_ _ x = execute
2_ w _ = write
3_ w x = write,execute
4r _ _= read
5r _ x = read,execute
6r w _ = read,write
7r w x = read,write,execute

Examples

Ensure that your home directory is not writeable by other users.

chmod g-w,o-w ~

To assign others segment read permissions only

sudo chmod o=r file1.txt

Assign different permissions to file, group and others

chmod u=rwx,g=rw,o=r filename.txt

Set file permissions of file1.txt to be the same as those of file2.txt

chmod --reference=file2.txt file1.txt
  • https://en.wikipedia.org/wiki/Chmod