Any file in Linux has three permissions of "user, user group and other users". A user can belong to multiple user groups. All user related information is recorded in the /etc/passwd
file, passwords are recorded in the /etc/shaodw
file, and user groups are recorded in /etc/group
document.
The root user has the highest permissions, not counting other users
1 2 3 4 5 6 7 8 9 10 11 12 |
|
It is divided into seven parts:
-
), directory files (d
), link files (l
) File name
Related tutorials:Linux video tutorial
For files, w
means that the content of the file can be modified (But does not include deleting files), x
means that the file has the permission to be executed (whether it can be executed actually depends on the content of the file).
The directory is mainly responsible for recording the file name list
r
: means that the directory structure can be readw
: Files (or directories) in this directory can be deleted, added, modified, moved, renamed, etc., with extremely high permissions x
: Can enter This directoryIf the user only has r permission on a certain directory, he can only view the file name and type in the directory, not even the file size and various attributes. For example, the zst user only has read permissions for the /home/zhoust
directory and can only see the file names in this directory.
1 2 3 4 5 6 7 8 |
|
##Read the contents of file1xr-Modify the content of file1xrw-can be entered and modifiedDelete file1 filewx--Be able to enter /dir1 and have directory modification permissions That’s it! Copy file1 to /dir2x#rwxMust be able to read file1 and be able to Modify the data in /dir2##Modify file attributes and permissionsIf the user does not have x permissions on a directory, he cannot execute any commands in the directory, nor can he query the contents of files in the directory.
Operation action | /dir1 | /dir1/file1 | /dir2 | Explanation |
---|---|---|---|---|
You must be able to enter /dir1 to read the file data inside! | ||||
, chgrp
, chmod
respectively represent the user to whom the modified file belongs, the user group to which the modified file belongs, and the modified file permissions
There are two types of syntax, one is to modify with numbers , the other is to use symbols to modify file permissions. Use numbers to modify, respectively
Add the numbers at the corresponding positions, for example: <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class='brush:php;toolbar:false;'># 在 /home/zhoust 目录下,其他用户都不可进入
[zhoust@MyPersonalCentOS ~]$ ls -al
drwxrwxr-x 2 zhoust zhoust 4096 Apr 21 14:55 learn
[zst@MyPersonalCentOS ~]$ cd /home/zhoust/
bash: cd: /home/zhoust/: Permission denied
# 使用 chmod 修改为其他用户可进入,zst 就能进入这个目录了
[zhoust@MyPersonalCentOS ~]$ chmod 705 .
[zhoust@MyPersonalCentOS ~]$ ls -al
drwx---r-x 5 zhoust zhoust 4096 Apr 21 14:55 .</pre><div class="contentsignin">Copy after login</div></div>
Use symbol type to modify file permissions, the format is
, u
belongs to the user, g
user group, o
other users, a
all users , the symbols used for modification are -=
, and the permissions are still the three rwx
. Now turn off other user permissions of the /home/zhoust
directory:
1 2 3 4 |
|
Copy after login
The above is the detailed content of Summary of knowledge points about file permissions in Linux learning. For more information, please follow other related articles on the PHP Chinese website!
Related labels:
Previous article:Shell command file compression and decompression gzip, zip detailed explanation
Next article:How to quickly connect a Linux virtual machine to WiFi
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2019-05-31 18:00:19
-
2019-05-31 17:53:44
-
2019-05-31 17:41:15
-
2019-05-31 17:32:51
-
2019-05-31 17:24:18
-
2019-05-31 17:15:01
-
2019-05-31 16:58:16
-
2019-05-31 16:37:47
-
2019-05-31 16:19:45
-
2019-05-31 16:04:54
Latest Issues
-
2025-03-17 17:32:12
-
2025-03-17 17:31:28
-
2025-03-17 17:28:37
-
2025-03-17 17:26:48
-
2025-03-17 17:25:31