In linux there the file access is based under three categories

 CurrentUser - Users in Group - Other Users
  drwxr-xr-x 


drwxr – CurrentUser can read, write and execute
xr – Users in Group can read and execute
x – Users can execute

 >>ls -l
-rw-r--r-- 1 root root    0 Apr 14 17:19 test.txt 

The test.txt file has only Read and Write access (rw) for Current User – Read access for Users in Group – Read access for other Users

 >>chmod u+x test.txt

Now the test.txt file has Execute access along with Read and Write as below

 >>ls -l
-rwxr--r-- 1 root root    0 Apr 14 17:19 test.txt

Giving Read wrtite to Group

 >>chmod g+r test.txt

Giving read right to Current User, Group Users and Other Users

 >>chmod a+r test.txt

Giving Execute right to Other Users

 >>chmod o+x test.txt

rwx – 111 7
r-x – 101 5
rw- – 110 6
rw- – 101 4
-wx – 011 3
-w- – 010 2
–x – 001 1
– 000 0

Example of binary format

 >>chmod 752  test.txt

Current User can rwx
Group User can r-x
Other User can -w-

Giving Multiple Permission for Multiple User Types at Once

 >>chmod u+r, o+x test.txt

Comments are closed.