Permission

When you do ls -l inside a directory you will see the following, so what does all those mean, 
here is the simple break down, 



-rw-------   1 ram      admin     576     Apr  17   1998    weather.txt
drwxr-xr-x   6 shyam    admin     1024    Oct  9    1999    web_page
-rw-rw-r--   1 hari     hr        276480  Feb  11   20:41   web_site.tar
-rw-------   1 srijana  db        5743    Dec  16   1998    xmas_file.txt

----------    -------   -------   --------    ------------      -------------                                                        
    |             |        |         |         |             |
    |             |        |         |         |         File Name
    |             |        |         |         |
    |             |        |         |         +---  Modification Time
    |             |        |         |
    |             |        |         +-------------   Size (in bytes)
    |             |        |
    |             |        +-----------------------        Group
    |             |
    |             +--------------------------------        Owner
    |
    +----------------------------------------------   File Permissions

perms1











The File Permissions: 

the first part consists of 10 ----
the first -  denotes the type , whether it is a directory or file or a link (like shortcut)
second third and fourth - is permission for owner, in our case walbert has permission of rwx
fifth sixth and seventh - is permission for group, in our case group owners in of support has permission of rx and
eighth ninth and tenth - is permission for other users that are neither owner or in group support


r= read permission
w=write permission
x=execute permission             (x for file will be used in scripts, in order for scripts to work it needs to have x permission)

                                 (x for folder will give permission to change directory to that folder)

rwx can also be denoted by numbers,

r=4
w=2
x=1

so is a looking above for file test, permission also can be denoted as,
750 

since owner walbert had rwx permission , adding numbers for rwx becomes 7,
then group support had rx permission,    adding numbers for rx becomes 5,
now others had no permission,            this is be 0.

if file had 
-rwx rw  rx, then 
permission would be
7    5    4






 

Leave a Reply