Centos 7 create user and group case

Now there is a company Company, the departments and employees are as follows:

Training Department ( T raining)

L i l ei

W ang x ue

Marketing Department ( M arket)

H An M Ei

L in l i

Management unit ( M Anage)

user1

user2

Now, to create a corresponding work folder for each department and employee, the requirements are as follows:

(1) All directories and files are stored in a unified folder

(2) Each department has an independent folder

(3) Different departments cannot access each other’s folders

(4) Each employee has a folder under his department folder

(5) Different employees in the same department can view each other’s folders, but they cannot be modified. Employees can only modify their own folders

solution:

①Create groups and users, and add users to the corresponding groups

②Create a Company folder under the root directory, create three department subdirectories, and set UGO permissions: 750.

(750:U:rwx:7;G:r-x5; O:--- 0

You can view the company's UGO permissions and other information at this time

③Continue to create employee directories, and specify its own employees and departments for each directory

1. Create employee directory

  • Create Training, Market, and Manage folders under the Company directory, and set UGO permissions to 750

  • View the users and groups of the three employee directories created

  • Use sentence: chgrp [option] group name file name  , modify the group

  • View the users who belong to the directories of the three modified employees

2. Modify each directory to specify its own employees

  • You can first check the user and group of the employee directory, now they are all root

  • Use sentence: chown [option] user or group file name  , modify the user

  • View the users who belong to the modified employee directory

3. Modify each directory to specify its department

 

  • View the group belonging to the modified employee directory 

 

4. Finally test, log in to verify that all requirements are met

5. Can not be viewed between different departments, and can be viewed and cannot be modified between the same departments, complete.

Guess you like

Origin blog.csdn.net/weixin_41987016/article/details/108824316