Task requirements
Research and Development Department developers David and Peter belong to group A;
The Administrative department personnel Jack and Mike belong to Group B;
1, the establishment of a shared directory "/project_a", the directory files can only be read by the research and Development Department developers, add, delete, modify and execute, other users can not do any access to the directory operation;
2, the establishment of the directory "/project_b", the contents of the document can only be read by the Administrative department staff, add, delete, modify and execute, other users can not do any access to the directory operation;
3, the establishment of the directory "/project", the directory of documents can be developed by the Department, the administrative department to read, add, delete, modify and execute, other departments users can only be read-only access to the directory operation.
Analysis
This problem only gives two groups, in fact, in order to achieve this feature requires 3 groups. A group of research and Development department, a group of administration department, including the development department and the Administration department need a group. The purpose of this topic is to familiarize yourself with group, user, and permission related commands.
Linux command
1. Create 3 groups
Groupadd A;
Groupadd b;
Groupadd AB;
2. Create 3 users and modify their passwords
useradd David;
passwd David;
Useradd Peter;
passwd Peter;
Useradd Jack;
passwd Jack;
Useradd Mike;
passwd Mike;
3. Create 3 folders in the root directory
mkdir project_a;
mkdir Project_b;
mkdir project;
4. Modify folder owning group
chgrp AB Project
chgrp a project_a
chgrp b project_b
5. Modify user-owned groups
Usermod-g A,ab David
usermod-g a,ab Peter
usermod-g b,ab Mike
usermod-g b,ab Jack
6. Use root to modify project, Project_a , Project_b access rights
chmod 774 project;
chmod 770 project_a;
chmod 770 Project_b;
Other commands
1. View a group of users:
groups Mike
2. Modify a user's owning group (belonging to more than one group):
usermod-g a,ab Mike
3. View file contents
Cat Hello.txt
4. Delete a file
rm Hello.txt
5. Delete a folder
rm-rf hello (forcibly delete) with rm-fr hello
rm-r Hello
6. Copy a file
CP Hello.txt HelloWorld.txt
7. Enter a folder
Cd/projcet (absolute path)
CD Projcet (relative path note at this point has entered the root directory)
8. Enter a character or string , enter the TAB key to view this character or the command at the beginning of the string
9. View the number of commands that Linux supports, and enter two tab keys
10. View command Help file man
chmod
11. View directory Structure
ls-l
12. View the directory structure (contains hidden files)
Ls-al