The adduser and useradd commands are the same commands (symbolic link is connected by symbols ).
Permission: system administrator.
Adduser is used to add users. In contrast, you can also delete user commands, userdel. Syntax: userdel [login ID]
Syntax
Adduser [-c comment] [-d home_dir] [-e expire_date] [-f inactive_time] [-g initial_group]
[-G group [,...] [-m [-k skeleton_dir] |-M] [-p passwd] [-s shell] [-u uid [-o] [-n] [-r] loginid
Or
Adduser-D [-g default_group] [-B default_home] [-f default_inactive]
[-E default_expire_date] [-s default_shell]
Parameter description:
- -C comment: annotation data of the new user in the password file (usually/etc/passwd)
- -D home_dir: Set the user's home directory to home_dir, and add the user account loginid after the preset home value.
- -E expire_date sets the validity period of this account (in the format of YYYY-MM-DD), default value is permanently valid
- -F inactive_time example:
Instance
Add a common user
# Useradd kk // add user kk
Specify the corresponding user group for the added user
# Useradd? G root kk // add user kk and specify the user group as the root user group
Create a system user
# Useradd? R kk // create a system user kk
Specify the/home directory for the newly added user
# Useradd-d/home/myf kk // add user kk, whose home directory is/home/myf
// When the user name kk logs on to the host, the default directory entered by the system is/home/myf