Linux is a multi-user multitasking operating system, all users who want to use system resources must first apply to the system administrator for an account, and then enter the system as the identity of the account. The user's account can help the system administrator to track the users who use the system and control their access to the system resources, on the other hand, it can help users organize files and provide security protection for users. Each user account has a unique user name and user password. Users can enter the system and their home directory by typing the correct username and password at logon.
To achieve the user account management, the work to be done mainly has the following several aspects:
A. Add, delete, and modify user accounts.
B. Management of user passwords.
C. Management of user groups.
Management of Linux user accounts
User account management mainly involves the user account add, delete and modify.
Adding a user account is to create a new account in the system, and then assign a user number, user group, home directory, and login shell to the new account. The account you just added is locked and cannot be used.
1. Create a new Test1 user and set a password for the user
Adduser/useradd test1
passwd test1
2. New Group1 User Group
Groupadd group1
Delete a group
Groupdel group1
Modify a group
Groupmod-n group2 group1
Rename Group1 to Group2
3. Create new Test1 user and add to group1 user group
Useradd-g test1 group1
4. Increase the Working Group for existing TEST1 users group2
Usermod-g group2 Test1
Or:
Gpasswd-a test1 group2
usermod-d/home/test-g test2 Test
Note: Shel for group-D home Directory-S for-G
Change the login directory of test user to/home/test and join Test2 Group, note that this is big G.
gpasswd-d test1 group2 Removes a user test1 from a group2 group
5, temporary shutdown: In the/etc/shadow file belongs to the user's line of the second field (password) before adding * on it. To restore the user, remove the * can.
Or, use the following command to close the user account:
passwd peter–l
Re-release:
passwd Peter–u
6. Permanently delete user account
Userdel Peter
Groupdel Peter
Usermod–g Peter Peter
(forcibly deletes all files and subdirectories under this user's home directory and home directory)
7, remove users from the group
Edit/etc/group Find GROUP1 line, delete A
or by command.
The code is as follows:
gpasswd-d A GROUP