Linux Permissions: Difference between revisions
(Created page based on "Linux permissions" from Lab Manual and added my own information about it) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
==Permission Values== | ==Permission Values== | ||
0 is no permissions | 0 is no permissions <br /> | ||
1 is execute permission <br /> | 1 is execute permission <br /> | ||
2 is write permission <br /> | 2 is write permission <br /> | ||
Line 10: | Line 10: | ||
7 is read, write, and execute <br /> | 7 is read, write, and execute <br /> | ||
The first number refers to the owner, second to the group, and third is other (anyone else who is not the owner or the group. | The first number refers to the owner, second to the group, and third is other (anyone else who is not the owner or the group. | ||
==Permission Examples== | ==Permission Examples== | ||
777: Everyone (owner, group, and other) has read, write, and execute permission | 777: Everyone (owner, group, and other) has read, write, and execute permission <br /> | ||
700: Only the owner of the file can read, write, and execute the file | 700: Only the owner of the file can read, write, and execute the file <br /> | ||
644: Owner has read and write permission but cannot execute. Group and other have read permission. | 644: Owner has read and write permission but cannot execute. Group and other have read permission. <br /> | ||
440: Owner and group can read the file. Any one else can't do anything with it. | 440: Owner and group can read the file. Any one else can't do anything with it. <br /> | ||
000: Nobody has any permission to do anything (don't ever do this) | 000: Nobody has any permission to do anything (don't ever do this) <br /> | ||
==Permission Related Commands== | ==Permission Related Commands== |
Latest revision as of 21:36, 30 June 2016
Permission Values
0 is no permissions
1 is execute permission
2 is write permission
3 is execute and write permission
4 is read permission
5 is read and execute
6 is read and write
7 is read, write, and execute
The first number refers to the owner, second to the group, and third is other (anyone else who is not the owner or the group.
Permission Examples
777: Everyone (owner, group, and other) has read, write, and execute permission
700: Only the owner of the file can read, write, and execute the file
644: Owner has read and write permission but cannot execute. Group and other have read permission.
440: Owner and group can read the file. Any one else can't do anything with it.
000: Nobody has any permission to do anything (don't ever do this)
Permission Related Commands
Use the command chmod to change the permissions of a file.
Usage:
chmod permissions_to_change_to file
This command will change the permissions of the file argument to the permissions you requested.
If there is a file named stuff with 777 permission, read ,write, and execute permission for everyone, then the following command would change the permissions of stuff to have read and write permission for the owner but only read permission for everyone else:
chmod 644 stuff