1: System User files
/ETC/PASSWD is used to save the file of the system user's user settings. To view the contents of a system User file:
cat/etc/passwd
2: View user password file
The file used to save the user's password is/etc/shadow, because Shadow is also a shadow, so someone calls it a shadow file and looks at the contents of the shadow file:
Cat/etc/shadow
3: Add user command
useradd [option] Tannengcai (Create a user with an account named Tannengcai)
The common options (option) are:
G: Specify the user group for the new user Useradd-g Group user (group with the Users group for the new user added using the option specified)
S: Specifies the shell used by the new user; Useradd-s/bin/ksh User (the default shell for user added with options specified is/bin/ksh)
4: Set User password command
When adding a user must remember to set the user password, or others can not login (no settings, password is messy)
passwd User (set user's password command)
5: Delete User command
Userdel [option] Username
The common option [option] is only r, and the function of this option is to delete the user in conjunction with the user's home directory and mail files, such as:
Userdel-r Tannengcai
If you forget to add the option r when deleting the user, you can only delete the user information, the user's home directory and mail files will also be retained, if you want to delete again, please use:
rm-rf/home/tannengcai/
6: User Management commands
usermod [option] Username
Common options [option] are:
L: Lock users, that is, prevent users from logging into the system
U: Unlock
E: Specify user Expiration Time
F: Refers to the buffer time after the user expires, that is, the number of days to log in after expiration
D: Specify a new home directory for the user
M: To specify a new home directory for users, move all files in the original home directory
S: Modify the user's default shell
Usage examples:
USER-L username;
User-u username;
USER-E username;
USER-F username;
user-d/file/user/home/user username;
user-d/file/user/home/user username-m username;
Linux User Management