Useradd adding users
Userdel Deleting a user
Useradd command format
# Useradd [Options] User name
Options:
-U UID: Manually specify the UID number of the user
-D Home Directory: Manually specify the user's home directory
-C User Description: Manually specify the user's description
-G Group name: Manually execute user's initial group
-G group Name: Manually specify additional groups for users
-S Shell: Manually specify the user login shell. Default is/bin/bash
[Email protected] ~]# Useradd Zhao
[Email protected] ~]# passwd Zhao
Changing password for user Zhao.
New Password:
Retype new Password:
Passwd:all authentication tokens updated successfully.
The user Zhao is added as command, and a login password is set. Once a user is created, its contents are automatically created for several files, respectively.
/etc/passwd,/etc/group,/etc/shadow,/etc/gshadow,/home/zhao (automatically create their home directory in the home directory),/var/spool/mail
Manually add a user based on the criteria.
# useradd U 666 G root,bin C "Test user" D/haha S/bin/bash Zhao
Add User Zhao, specify its uid is 666, append group is root and bin (note: A group that already exists in the system can be used as the user's additional group), the user is described as test user, the user's home directory is/haha, the shell type is/bin/bash
Userdel command format
# Userdel [Options] User name
Options:
-r: Delete User's home directory while deleting users
-F: Force the deletion of a user (you can force the deletion of a user logged on the system)
The-f option does not affect the actions of users who are already logged on in the system, and when a user who is forcibly removed exits, logging in again will not take effect.
This article is from the "LULU" blog, make sure to keep this source http://aby028.blog.51cto.com/5371905/1865600
Useradd,userdel Command Small Summary