1:/etc/passwd
Open the file and you can see that each line is divided into 7 fields such as: Root:x:0:0:root:/root:/bin/bash
The first field indicates that the user name is the root userThe
second field holds the password for the account, the early UNIX is stored here, and for security reasons, it is stored in/etc/shadow here with X insteadThe
third field indicates the user's UID (master) root is 0 that is the maximum privilege 1-499 is the administrative account of the system average user starting from 500 as Flex:x:500:500:flex:/home/flex:/bin/bashThe
Fourth field indicates that the user's GID (group) and UID are similar
The
fifth field is a comment, it has no practical meaning and can be empty
The sixth field is the user's home directory after the root user is logged in under /root Flex login is under /home/flex can modify this field. and change the home directory .
The Seventh field is the user's shell
2:/etc/shadow
Open under Root
root:$6$vai79wvf5elmdhec$eucjhcxcxf4h471ekanjb/q2eeez6kj13smzuixe7c/esbth/ Mcttgxz41occfzjd.opiglxeq42rgjdr10e20:16918:0:99999:7 :::
a total of nine fields
The first field is a user name
The second field is password encrypted
The third field is the date the password was last changed
fourth field after how many geniuses can change the password by default to 0 unrestricted
The fifth field expires after a number of days, 99999 means never expires
The sixth field is the warning period before the password expires
The Seventh field is the account expiration period. If the password expires, if the user does not change the password, then the account will be locked after the deadline
The Eighth field is the time the account existsThe
nineth field has no meaning
3: New user group Groupadd [-g] Group name
groupadd grptest1 New group grptest1
groupadd-g 511 grptest2 New group grptest2 GID for 511
4 Deleting a user group Groupdel
Groupdel Grptest2 If there are other accounts in the group Grptest2, the account must be deleted before the group can be deleted.
5: Add user command Useradd useradd [-u UID] [-G GID] [-D HOME] [-m] [-s]-
m indicates that the home directory-S is not established to represent the custom shell
useradd test10 Creating a test10 user also creates a group with the same name as the user
useradd-u 510-g 513-s/sbin/nologin user11 Create a user belonging to GID 513 User11 custom shell for/sbin/nologin
6: Delete User
Userdel [-r] Username
-R will delete the user's home directory
7: Change Password
passwd Changing the root password
passwd username Change the password for an account
8:sudo
Add the account that needs to execute this command in/etc/sudoers Flex all= (All) all
user Flex will be able to use the sudo command
Linux Learning Essay-group and user management