JAVA SCRIPT

RH033 4. CHANGE PERMISSIONS OF FILE/DIR:

-> FIELDS OF ls -l


-rw-r--r-- 1    
  root       root       697    May 22 13:16     cis-linux.conf

1.Permission
2. Link count //link count for file is 1 link count for dir is 2.(  Link count of dir increases as u add dir inside it.)
3.owner of file
4.group-owner of file
5.size of file
6.time of creation
7.file name


Default permission for file/dir when root user creates a file/dir. Where - is file ,  d is dir     

  FILE     -|rw-|r--|r--      
   

  DIR      d|rwx|r-x|r-x  

 
Default permission for file/dir when normal user creates a file/dir.

  FILE  -|rw-|rw-|r--   

  DIR   d|rwx|rwx|r-x  




HOW  TO  CHANGE PERMISSIONS  OF  FILE/DIR:


  1.Symbolic method.

u=owner         r=read              +   Add
g=group         w=write           -    Del
o=others        x=execute      =  Assign

  chmod  u+x,g+x,o+w  <file>      -->add permission
  chmod  u-x,g-x,o-w     <file>      -->take back permission
  chmod  ugo=rw           <file>      --> assign permission



2. Numeric Method

   1=Execute                                     4=read
   2=write                                           5=read + execute
   3=write + execute                     6=read + write
   4=read                                             7=full
  
   chmod  777 <file/dir>
   chmod  444 <file/dir>
   chmod  664 <file/dir>


No comments:

Post a Comment