Linux Permissions

From DISI
Jump to navigation Jump to search

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