11.1 rwx Permissions Detailed 11.1.1 rwx effect to file
(1) "R" stands for readable (read): Can read, view.
(2) "W" for Writable (write): Can be modified, but does not mean that the file can be deleted, deleting a file if you have write permission to the directory where the file is located in order to delete the file.
(3) "X" means executable (execute): can be executed.
11.1.2 rwx effects to the directory
(1) "R" stands for readable (read): Can read, view.
(2) "W" stands for Writable (write): You can modify, create, delete, and rename directories within the directory.
(3) "X" means executable (execute): You can enter the directory.
11.2 Practical Cases
-rw-r--r--. 1 root root 26788 4月 14 16:53 java后端生活.jpg
? The preceding 10 characters -rw-r--r-- determine what different users can do with the file:
The first character represents a file type: File (-), directory (d), link (l);
The rest of the characters are each 3 groups (RWX):
First set of rw-: The permissions of the file owner are read and write, but cannot be executed;
Second set of r--: The permissions of the user in the same group as the file owner are read-only and cannot be written and executed;
Third group r--: the permissions of other users who are not in the same group as the file owner are read-only and cannot be written and executed;
The available numbers are expressed as: r=4,w=2,x=1; so rwx=4+2+1=7
1: File is a hard connection number, directory is a subtree
Root: User
Root: Group
26788: File Size (bytes), if folder is displayed 4096 bytes
April 14 16:53: Last Modified Date
Java back-end life. jpg: File name
11.3 Modifying permissions 11.3.1 basic instructions
With the chmod directive, you can modify the permissions of a file or directory
11.3.2 First way: + 、-、 = Change permissions
U: Owner
G: Group
O: Others
A: Everyone (sum of u, G, O)
(1) chmod u=rwx,g=rx,o=x file directory name
(2) chmod o+w file directory name
(3) chmod a-x file directory name
11.3.3 Second way: Change permissions by number
Rule: r=4,w=2,x=1,r+w+x=7
chmod u=rwx,g=rx,o=x file directory name
Equivalent to chmod 751 file directory name
11.4 Modify File Owner 11.4.1 Basic Introduction
Chown Newowner file Changes the owner
Chown Newowner:newgroup file changes the owner and group of files
-R If it is a directory, make all sub-files and directories under it recursively take effect
11.5 Modifying the group of files
CHGRP newgroup file changes the group in which the files are located
Linux (11) Rights Management