New linux users-File Permission and modification, new linux permission Modification
If you access or execute a file to display Permission deny, this is generally a Permission issue.
Use"ls -l
"You can view the detailed information of files in this directory.
1. Read Permissions
The first column is the permission information, as shown in the following figure:
drwxr-xr-x
Or
-rwx------
And so on.
The first character indicates that the file is a directory or file, d indicates a directory,-indicates a file, and other characters such as B, c, and s.
Each of the last nine characters is divided into three groups. The first group represents the permissions of the owner, the second group represents the permissions of the user group, and the third group represents the permissions of other users.
R indicates read, w indicates write, and x indicates execution.
They are represented by a number respectively. r is 4, w is 2, and x is 1. Permissions for each identity are accumulated, so-rwx------
The owner's permission is 7, and the permissions of user groups and other users are 0.
2. Modify permissions
The command for modifying permissions is chmod. Shape:
chmod -R 777 filename
This means to change the folder permission of filenamedrwxrwxrwx
-R indicates recursive changes, that is, all files in the subdirectory are changed.
You can also modify it in the form of u (owner) g (User Group) o (other users), such:
chmod u=rwx,go=rx filename
The file filename is changed-rwxr-xr-x
.
chmod a+w filename
This means that all three permissions of the filename file are granted with w permissions.
chmod a-w filename
This means that all three permissions of the filename file are revoked by w. Similarly.
3. Directory and File Permissions
The directory does not have the x permission, indicating that it does not have the execution permission and cannot enter the Directory through the cd command.
If you have w permissions on the directory but do not have the permissions on the files under the directory, you can still Delete this file! Because w indicates that you have the permission to change the directory, regardless of the file permission.