Latest web development tutorials

Linux adduser command

Linux command Daquan Linux command Daquan

Linux adduser command to add a new user or update default user account information.

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

Access: System Administrator.

adduser is to increase user. In contrast, there are deleted user commands, userdel.Syntax: userdel [login ID]

grammar

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 new user password file is located (usually / etc / passwd) annotation data
  • home set back -d home_dir user's home directory home_dir, default is the default user account plus loginid
  • -e expire_date set this account the period of use (in the format YYYY-MM-DD), default is permanent
  • -f inactive_time Example:

Examples

Add a general user

# useradd kk //添加用户kk

Specify the appropriate user group for the user to add

# useradd ?g root kk //添加用户kk,并指定用户所在的组为root用户组

Create a system user

# useradd ?r kk //创建一个系统用户kk

Specify the / home directory for the newly added user

# useradd-d /home/myf kk //新添加用户kk,其home目录为/home/myf
//当用户名kk登录主机时,系统进入的默认目录为/home/myf

Linux command Daquan Linux command Daquan