File permissions of any file/directory are controlled using chmod command. The chmod command uses a three digit code as an argument. These three digits set the permissions. Any file/directory in Unix has the following groups/users:
1. Owner
2. Group (Group of users that has been set up)
3. World (anyone else browsing on the file system)
Each digit of this code sets permissions for one of these groups as follows. Read is 4. Write is 2. Execute is 1
The first "-" above tells that bash_logout is a file. The first three letters "rw-" tells that the file has read & write permission for its owner. Then the next three symbols, r--, show that the group permissions are read only. The final three symbols, r--, show that the world permissions are read only.
1. Owner
2. Group (Group of users that has been set up)
3. World (anyone else browsing on the file system)
Each digit of this code sets permissions for one of these groups as follows. Read is 4. Write is 2. Execute is 1
The sums of these numbers give combinations of these permissions:
· 0 = no
permissions whatsoever; this person cannot read, write, or execute the file
· 1 =
execute only
· 2 = write
only
· 3 = write
and execute (1+2)
· 4 = read
only
· 5 = read
and execute (4+1)
· 6 = read
and write (4+2)
· 7 = read
and write and execute (4+2+1)
E.g.,
ubuntu@ip-10-134-173-143:~$ ls -al
-rw-r--r-- 1 ubuntu ubuntu 220 2011-05-18 09:54 .bash_logout
ubuntu@ip-10-134-173-143:~$
The first "-" above tells that bash_logout is a file. The first three letters "rw-" tells that the file has read & write permission for its owner. Then the next three symbols, r--, show that the group permissions are read only. The final three symbols, r--, show that the world permissions are read only.
No comments:
Post a Comment