Group management and authority management
-
- One, group management
- Two, authority management (important)
-
- (1) Permission introduction
- (2) Detailed explanation of rwx permissions
- (3) Actual case of file and directory permissions
- (4) Modify permissions
-
- ① Pass +-= change authority
-
-
- Case 1: Give the owner of a1.txt the read-write and execute permission, the read-execute permission to the group where it belongs, and the read-execute permission to other groups.
- Case 2: Remove the execute permission to the owner of the a1.txt file and increase the group write permission
- Case 3: Add read permission to all users of the a1.txt file
-
- ② Change authority by number
- (5) The owner of the modified file
- (6) Modify the group of the file
- (7) Best Practice-Police and Bandit Games
-
- ① Create a group
- ② Create user
- ③ Jack creates a file, he can read and write, and people in this group can read it, but no one in other groups has any permissions.
- ④ Jack modifies the file so that other people in the group can read, and this group can read and write
- ⑤ xh go to the police to see if you can read and write
One, group management
(1) Basic introduction of Linux group
(2) File/directory owner
① View the owner of the file
指令:ls –ahl
Case 1: Create a group police, then create a user tom, put tom in the police group, and then use tom to create a file ok.txt to see how the situation is
② The owner of the modified file
指令:chown 用户名 文件名
Case 1: Use root to create a file apple.txt, and then change its owner to zhangfei
(3) Creation of group
指令:groupadd 组名
Case 1: Create a group, ,monster
Case 2: Create a user fox and put it into the monster group
(4) The group of the file/directory
① Modify the group where the file is located
指令:chgrp 组名 文件名
Case 1: Use the root user to create a file orange.txt to see which group the file belongs to, and then modify the group where the file belongs to the fruit group.
(5) Other groups
(6) Change the user's group
Case 1: Change the user zwj from the original group to the wudang group.
Two, authority management (important)
(1) Permission introduction
(2) Detailed explanation of rwx permissions
(3) Actual case of file and directory permissions
(4) Modify permissions
① Pass +-= change authority
Case 1: Give the owner of a1.txt the read-write and execute permission, the read-execute permission to the group where it belongs, and the read-execute permission to other groups.
Case 2: Remove the execute permission to the owner of the a1.txt file and increase the group write permission
Case 3: Add read permission to all users of the a1.txt file
② Change authority by number
Case 1: Modify the permissions of the /home/a1.txt file to rwxr-xr-x, and use the digital method to achieve
(5) The owner of the modified file
Case 1: Please modify the owner of the /home/abc.txt file to tom
Case 2: Please modify the owner of all files and directories in the /home/kkk directory to tom
(6) Modify the group of the file
Case 1: Please modify the group of the /home/abc.txt file to shaolin
Case 2: Please modify the group of all files and directories in the /home/kkk directory to shaolin
(7) Best Practice-Police and Bandit Game
① Create a group
② Create user
③ Jack creates a file, he can read and write, and people in this group can read it, but no one in other groups has any permissions.
ps: The login user is jack at this time
④ Jack modifies the file so that other people in the group can read, and this group can read and write
⑤ xh go to the police to see if you can read and write
ps: It can be seen that Jack's home directory does not allow any operation by others , so you need to let go of a little permission and increase the permission to read and write to this group of people
ps: After modifying the group, you need to log in to xh again