Linux adduser command
The Linux adduser command is used to add user accounts or update preset user information.
The adduser and useradd commands are the same command (via a symbolic link).
Permissions: system administrator.
adduser is used to add users. Correspondingly, there is also a command for deleting usersuserdel, and its syntax isuserdel [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 The comment data of the new user in the password file (usually /etc/passwd)
- -d home_dir Set the user's home directory to home_dir; the default value is the default home followed by the user account loginid
- -e expire_date Set the expiration date for this account (format: YYYY-MM-DD), the default is permanently valid
- -f inactive_time Example:
Examples
Add a normal user
# adduser kk //添加用户kk
Specify the corresponding user group for the added user
# adduser -g root kk //添加用户kk,并指定用户所在的组为root用户组
Create a system user
# adduser -r kk //创建一个系统用户kk
Specify the /home directory for the newly added user
# adduser -d /home/myf kk //新添加用户kk,其home目录为/home/myf //当用户名kk登录主机时,系统进入的默认目录为/home/myfOther Extensions
Linux Command Reference