add

Tuesday, May 29, 2012

linux file permission simplest rule of thumb


Chmod 777 –R /var/www/html/webdir
Permission level
1.       r (read)       =  4
2.       w (write)     =  2
3.       x (execute)  =  1

For example : 
chmod 753 abc.txt thus means
assign (4+2+1)(4+1)(2+1) to abc.txt

=>
assign (rwx)(rx)(wx) to abc.txt
assign (owner)(group)(other) to abc.txt
Another example

chmod 572 dump.txt thus means
assign (4+1)(4+2+1)(2) to 
dump .txt
=>
assign (rw)(rwx)(w) to  dump .txt

2 comments:

  1. Can you explain what the three characters do?

    like I think chmod 7 abc.text should mean allow read write and execute to the file abc.text,

    why write 7 three time as follows: chmod 777 abc.txt

    ReplyDelete
  2. dear jubair,
    have a look at example 1
    assign (rwx)(rx)(wx) to abc.txt
    assign (owner)(group)(other) to abc.txt
    this clearly shows the right for each section
    so 751 mean
    1. left most option is for owner i.e owner can read/write and execute(4+2+1)
    2. figure in center i.e 5 is for group.A member of that particular group can read+execute (4+1)
    3. right most digit ,in this case 1 is for others(any other user)
    so other user can eXecute (1)
    Thanx

    ReplyDelete