Home >Operation and Maintenance >Linux Operation and Maintenance >Can linux check and obtain file permissions?
Linux can view and obtain file permissions. Viewing method: 1. Use the cd command to move to the file path that needs to be queried. The syntax is "cd specified file"; 2. Use the "ls-l" command to view the permissions of the file. The 9 characters to the right of the first character in the result The characters are file permissions, and each group of three represents the read, write, and execute permissions of the owner, group members, and other users.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
1. Use the cd command to move to the file path that needs to be queried
2. Use the command ls -l can check the file permissions. The output example is as follows
The 9 characters to the right of the first character are the file permissions. Each group of 3 represents the ownership. Read, write, and execute permissions for the owner, group members, and other users
r: Read permission
w: Write permission
x: Execute permission
-: No permission for this location
For example: rwxr-xr-x It means that the file owner has read, write, and execute permissions, group members have read and execute permissions, and other users have read and execute permissions.
Extended knowledge
File permissions
Linux maintains a set of permissions for each file File permissions are divided into three types: read, write, and execute. For different file types, the meaning of permissions is different, as follows
Ordinary files (non-directories): read permission allows the user to read the file, write permission allows the user to write the file, and execute permission allows the user to execute the file. For non-executable files, execute permission is useless. Permissions can be combined, for example, modifying a file requires read and write permissions, allowing scripts to require read and execute permissions.
Directory: Read permission allows users to read file names in the directory, write permission allows users to modify the directory, and execute permission allows users to search the directory.
There is also a special permission setuid, which allows ordinary users to have root permissions, such as the passwd program.
Root users can ignore permissions
Recommended learning: Linux video tutorial
The above is the detailed content of Can linux check and obtain file permissions?. For more information, please follow other related articles on the PHP Chinese website!