Understanding Linux File Permissions :Basic File Permissions
Permission Groups :Each file and directory has three user based permission groups:owner - The Owner permissions apply only the owner of the file or directory, they will not impact the actions of other users.
group - The Group permissions apply only to the group that has been assigned to the file or directory, they will not effect the actions of other users.
all users - The All Users permissions apply to all other users on the system, this is the permission group that you want to watch the most.
Permission Types :Each file or directory has three basic permission types:
read - The Read permission refers to a user’s capability to read the contents of the file.
write - The Write permissions refer to a user’s capability to write or modify a file or directory.
execute - The Execute permission affects a user’s capability to execute a file or view the contents of a directoryCommand to viewing the permissions : “ls -l”
==============================================
The permission in the command line is displayed as: _rwxrwxrwx 1 owner:group1. User rights/Permissions 1. The first character that I marked with an underscore is the special permission flag that can vary. 2. First set ( three characters ) : owner permissions. 3. Second set ( three characters ) : Group permissions. 4. Third set (three characters ) : All Users permissions.
- Following that grouping since the integer/number displays the number of hardlinks to the file.
- The last piece is the Owner and Group assignment formatted as Owner:Group.
Modify Permissions Command : chmodThe Permission Groups used are:* u - Owner
- g - Group
- o or a - All Users
Assignment Operators are + (plus) and - (minus); these are used to tell the system whether to add or remove the specific permissions.
The Permission Types that are used are:* r - Read
- w - Write
- x - Execute
To make this modification you would invoke the command: chmod a-rw file1
To add the permissions above you would invoke the command: chmod a+rw file1Using Binary References to Set permissions :
——————————————–
For example : chmod 640 file1, which means owner : read and write permissions group : read permissions, all other user : no rights to the file.
Representation of numbers in permission :First number represents : Owner permissionSecond represents : Group permissionsLast number represents : permissions for all other users.
The numbers are a binary representation of the rwx string.* r = 4
- w = 2
- x** = 1 So to set a file to permissions on file1 to read _rwxr_____, you would enter chmod 740 file1**. Full article : Read More