We know that permissions are very important to the user account because he can restrict users from reading/creating/deleting/modifying files or directories! In this chapter we introduce a lot of file system management directives, the fifth chapter introduces the meaning of many file permissions. In this section, we will combine the two to explain what kind of command under what permissions to run it! ^_^
First, allow users to enter a directory to become a "working directory" of the basic permissions:
- Directives that can be used: for example, the instructions for changing working directories such as CDs;
- Permissions required by the directory: the user must have at least X permission on this directory
- Additional requirements: If the user wants to use LS to look up the file name in this directory, then the user also needs R permission on this directory.
Second, the user in a directory to read a file's basic permissions?
- Available directives: For example, cat, more, less, etc. discussed in this chapter
- Permissions required by the directory: the user must have at least X permission on this directory;
- Permissions required for the file: the user must have at least R permission on the file!
Third, let the user can modify the basic permissions of a file?
- Available directives: such as the Nano or the VI Editor to be introduced in the future;
- Permissions required for the directory: the user must have at least X permission in the directory where the file resides;
- Permissions required for the file: the user must have at least R, W permissions on the file
Iv. What are the basic permissions for a user to create a file?
- Permissions required for the directory: the user must have W,x permissions in the directory, focusing on W!
What are the basic permissions for users to enter a directory and execute an instruction under that directory?
- Permissions required by the directory: the user must have at least X permission on the directory;
- Permissions required by the file: the user must have at least X permission on the file
Example: Let a user Dmtsai be able to carry out "CP/DIR1/FILE1/DIR2" instructions, please explain Dir1, file1, dir2 the minimum required permissions? A: When executing CP, Dmtsai to "be able to read the source file and write to the target file!" "So refer to the 2nd and 4th instructions above!" Therefore, the minimum permissions for each file/directory should be:
- Dir1: At least x permission is required;
- File1: At least R permission is required;
- Dir2: At least W, x permission is required.
Example: There is a full file name of/home/student/www/index.html, the permissions of each related file/directory are as follows:
drwxr-xr-x 23 root root 4096 Sep 22 12:09 /drwxr-xr-x 6 root root 4096 Sep 29 02:21 /homedrwx------ 6 student student 4096 Sep 29 02:23 /home/studentdrwxr-xr-x 6 student student 4096 Sep 29 02:24 /home/student/www-rwxr--r-- 6 student student 369 Sep 29 02:27 /home/student/www/index.html
Vbird This account (not belonging to the student group) can read index.html this file? A: Although www and index.html are allowed to Vbird Read permissions, but because the directory structure is a layer of root directory read, so vbird can enter/home but not into/home/student/, since even enter/home/studen T is not allowed, of course, can not read the index.html! So the answer is "Vbird won't read the content of index.html" Oh!
So how do you modify permissions? In fact, as long as the/home/student permission to modify the minimum 711, or give 755 directly can be! That's a very important concept.
[Linux] The relationship between permissions and instructions