Linux command (10)-to add and reduce permissions to the file chomod command

Meaning of each alphanumeric

First of all, we must understand what each letter means after entering the ls -l command.

As shown in the figure, the first letter represents the file type, if it is-it means it is a file, if it is d it means it is a file Folder The
next three letters are grouped together, namely rwx, r—readable operation, w—writable operation, x—executable operation, if yes, it means that there is no such permission
. The first rwx group is the current file ( Folder) owner, that is, the permissions owned by the user. The
second rwx is a group of permissions owned by users in the same group. The
last rwx is the permissions owned by other users.
Then the first location that is blue is the file ownership were
coated blue file belongs to the second group of position
behind the numeral 8 means that the number of hard links
4096 is representative of the meaning behind the file size in bytes
behind Sep 28 09:49 file modification time is , The last one is the file name

chmod command

This command can modify the second letter to the tenth letter

1. Use letters to modify the corresponding permissions

The letter represented by the first rwx is u , which is the user
. The letter represented by the second rwx is g , which is the user group
. The letter represented by the third rwx is o , which represents
additional permissions for other users . and to reduce the rights of + and -
= Representative impart u / g / o appropriate permissions
Example:
Insert picture description here
Insert picture description here
Insert picture description here
In this case, green a.txt been described into an executable file

2. Use numbers to modify the corresponding permissions

Each permission has a corresponding permission value
r The corresponding permission value is 4
w The corresponding permission value is 2
x The corresponding permission value is 1
-The corresponding permission value is 0
Example:
Insert picture description here
At this time, the corresponding permissions of the file are:
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_48445640/article/details/108843750