Saturday, 12 May 2012

CHMOD in linux

chmod command gives access mode for users.Each time no need to go that folder directories and right click the folder and changing the permisson.just Go to the command prompt window and give the command chmod.


chmod who=permissionmode directory or folder or file


This gives “who” the specified permissionmode for a given filename.
 "who" list of representation of three different roles:
  • u is for user,
  • g is for group,
  • and o is for others.
"permissionmode" is list of representation of three different permissions:
  • r is for read permission,
  • w is for write permission,
  • x is for execute permission.
CHMOD can also to attributed by using Numeric Permissions:
  • 400 read by owner
  • 040 read by group
  • 004 read by anybody (other)
  • 200 write by owner
  • 020 write by group
  • 002 write by anybody
  • 100 execute by owner
  • 010 execute by group
  • 001 execute by anybody
use of the numeric codes use can combine any of numeric codes and form one number use of that give access mode to depend on user


List of some useful chmod by numbers

  1.         chmod  -R 777 ---->full access to everyone
  2.         chmod  -R 666 ---->read and write permission to everyone
  3.         chmod  -R 755 ----> Anyone write to the file
  4.         chmod  -R 644 ----> Read and write by owner and read by every one else

        -R is noting but recursive


Example To Form Numbers use of Numeric Codes:


  400+040+004+200+100+010+001 = 755 this represents (-rwxr-xr-x).


   chmod  -R 777 test.html means giving full access to the .html file
or you can give permission like this also
   chmod u+x test.html  which gives execute permission for user.
   Like wise you can give multiple permission also.
  

No comments:

Post a Comment