- The Linux system is a multi-user and multi-task operating system. Any user who wants to use system resources must first apply for an account from the system administrator, and then enter the system as this account.
- Linux users need to belong to at least one group
1. Add a user
useradd [options] username
-
When the user is successfully created, a home directory with the same name as the user will be automatically created
-
You can also specify the new user name of the directory through useradd-d, and specify the home directory for the newly created user
2. Assign or modify the password for the user
passwd username
delete users
userdel username : delete the user to keep his home directory
userdel -r username : delete the user and the user's home directory
When deleting a user, we generally do not delete the home directory.
3. Query user information
id username
4. Switch users
In operating Linux, when we have insufficient permissions, we can switch to a high-privileged user through su- username
su-username
- Switching from a user with high authority to a user with low authority does not require a password, and vice versa.
- When you need to return to the original user, use the exit command
5. User group
Similar to roles, the system can perform unified management of multiple users with commonalities.
5.1, add group
groupadd group name
5.2, delete group
groupdel group name
5.3. Add groups when adding users
useradd -g user group username
5.4, modify user group
usermod -g user group username
6. /etc/passwd file
- User (usen) configuration file, which records various user information
- Meaning of each line: user name: password: user identification number: group identification number: annotation description: home directory: login Shell
vim /etc/passwd
7. /etc/shadow file
- Password configuration file
- Meaning of each line: Login name: Encrypted password: Last modification time: Minimum time interval: Maximum time interval: Warning time: Inactivity time: Expiration time: Sign
8. /etc/group file
- Group (group) configuration file, record the group information contained in Linux
- Meaning of each line: group name: password: group identification number: list of users in the group
Thank you all for reading! If there is a mistake in the above, please correct it
Recommended learning linux video B station is still Silicon Valley Hanshun Ping teacher