In general the below are the 5 values which we'll use for permissions in unix.
You can also use them by adding them. For example if you would like to give Read & Write access then you can use 2+4 = 6. If you would like to give Read and Execute access then you can use 1+4 = 5.
- 0 - No Access
- 1 - Execute
- 2 - Write
- 4 - Read
- 7 - Full Access
Usually file permission field is a 3 digit number. First digit denotes the OWNER of the file/folder, second digit denotes GROUP, third digit denotes EVERYONE.
chmod 400 file - Read by owner
chmod 040 file - Read by group
chmod 004 file - Read by world
chmod 200 file - Write by owner
chmod 020 file - Write by group
chmod 002 file - Write by world
chmod 100 file - execute by owner
chmod 010 file - execute by group
chmod 001 file - execute by world
chmod 111 file - Allow execute permission to owner and group and world
chmod 222 file - Allow write permission to owner and group and world
chmod 444 file - Allow read permission to owner and group and world
chmod 777 file - Allow everyone to read, write, and execute file
You can also use them by adding them. For example if you would like to give Read & Write access then you can use 2+4 = 6. If you would like to give Read and Execute access then you can use 1+4 = 5.
0 comments:
Post a Comment