Tools: How to Read and Set Linux Permissions
Overview
How to Read Permissions
File Types
Types of Permissions
For Files
For Directories
Example
How to Set Permissions
Specifying Numerically
Specifying Alphabetically
Target
Method
Content
References
Additional Notes This post summarizes Linux permissions. The first character represents the file type. Subsequent characters, in groups of three, represent permissions for different owners of the file. 2~4th characters: User permissions for the file owner
5~7th characters: Group permissions for the owning group8~10th characters: Other permissions There are three types of permissions: r Readw Writex Execute The meaning changes depending on whether it's a file or a directory. r Read: Can read the file contentsw Write: Can edit the file contentsx Execute: Can execute the file as a program r Read: Can display the list of files under the directoryw Write: Can create or delete files under the directory※1x Execute: Can move into the directory※2 ※1 Files under the directory can be deleted even without write permission※2 If execute permission is not granted to the directory, you cannot move into it Permissions for hoge.md File type: FileUser permissions: Read/WriteGroup permissions: ReadOther permissions: Read Permissions can be specified numerically or alphabetically. Use the chmod command to set permissions. chmod mode target_filename Use three digits to specify permissions. The hundreds place is for the user, the tens place is for the group, and the ones place is for others. 4 r Read2 w Write1 x Execute To grant multiple permissions, specify the sum of the numbers. For example, to grant read and write permissions, specify 6; to grant all permissions, specify 7. chmod target+method+content target_file Specify the target, method, and content using alphabets and symbols. u Userg Groupo Othersa All Multiple targets can be specified. For example, to target both user and group, specify ug. = Set specified permissions r Readw Write
x Execute Multiple contents can be specified. For example, to specify read and write, specify rw. The number 1 displayed next to the permissions in the output of ls -l represents the number of hard links. Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to ? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse