Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux adduser Command

Linux adduser Command

Linux Command Reference Linux Command Reference

The Linux adduser command is used to create new user accounts or update default user information.

adduser and useradd are the same command (via a symbolic link).

Permission required: system administrator.

adduser adds a user. Correspondingly, there is also a command to delete a user userdel, with the 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:

Example

Add a regular user

# adduser kk //添加用户kk

Assign an appropriate user group to 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

//When user kk logs into the host, the default directory the system enters is /home/myf

Linux Command Reference Linux Command Reference