Friday, September 27, 2013

UNIX permissions

Permissions

Every file on the system has associated with it a set of permissions. Permissions tell UNIX what can be done with that file and by whom. There are three things you can (or can't) do with a given file: 
read it, 
write (modify) it and 
execute it.

For any given ownership relation, we need three letters to specify access permissions: the first denotes read (r) access, the second denotes write (w) access and the third denotes execute (x) access.

We have three ownership relations: 'owner', 'group' and 'all' so we need a triplet for each, resulting in nine letters.

Lets try something in our command prompt with ls -l command.

umasarath@ubuntu:~$ ls -l
total 53780
-rw-r--r-- 1 umasarath group 27455157 2012-11-16 10:28 sample.xml
drwxr-xr-x 2
umasarath group     4096 2013-01-23 10:17 files
-rw-r--r-- 1
umasarath group     1338 2013-09-14 08:32 keystore
drwxr-xr-x 2
umasarath group     4096 2013-09-16 10:02 logs
drwxr-xr-x 2
umasarath group     4096 2013-09-25 11:21 softwaresumasarath@ubuntu:~$
 From the above output, lets take an example. For logs, the permission of the folder is drwxr-xr-x. Lets break it down.

As previously said, it is 9 letter, 

d - stands for directory
rwx - Read, write and execute permissions for the user
r-x - Read and execute permissions for the group
r-x - Read and execute permissions for all

Check here for CHMOD command and strange numbers

No comments:

Post a Comment