1. Permissions of users (user), user groups (group), and others (others) to files under Linux
Linux file attributes You can view all attribute information of files in the current folder by typing ls -al in the terminal.
-rwxrwxrwx 3 root root 36 Sep8 14:07 a.txt
The first represents the file type
- stands for normal file, txt, etc.
d stands for directory
| Link file Linkfile
b interface device
c serial file (keyboard, mouse)
The first set of rwx are the permissions of the file owner
The second group of rwx is the permissions of the user group to which the file belongs
The third group of rwx is the permissions of others
3 means the number of file connections
The first root means the file owner
The second root indicates the user group to which the file belongs
update time
file name
Detailed file permissions section
Different meanings for directories and files rwx
A. For a directory directory is a list of its subterranean filenames
so
r means, the read of its file name
w means that the file name under the folder can be deleted, renamed, shifted and added.
x means, you can enter the change directory
B. to file
r can read file contents
w can modify the content of the file, but can not modify the file name and delete the file
x executable file (under linux, whether the file can be executed or not depends on the suffix, but also depends on whether the permission allows it to be executed)
Modify the attributes of a file or directory
1. Modify the owner
chown [-R] root a.txt
It can also be used to modify the file user group such as chown [-R] root.root a.txt root.root represents the root user under the root user group
You can also only modify the user group such as chown [-R] .root a.txt . No content is added before
2. Modify the user group to which the file belongs
chgrp [-R] root a.txt
3. There are two ways to change file permissions
the first method
rwx = 4 + 2 + 1 = 7 r-x = 4 + 1 =5
421 corresponds to the permission value
chmod [-R] 775 a.txt 775 is the permission value of owner, group, others
The second method a=all g=group u=user o=other
chmod u+w a.txt
chmod u=rwx,g=rwx,o=rx a.txt
chmod u=rwx,go=rx a.txt
Linux directory configuration
Directory Configuration Standard: FHS