English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux adduser command

Linux Command大全

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

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

Access Permission: System Administrator.

adduser is used to add users. Conversely, there is also a command to delete users, 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 The new user is located in the password file (usually /etc/passwd) annotation information
  • -d home_dir Set the home directory of the user to home_dir, the default value is the default home plus the user account loginid
  • -e expire_date Set the usage period of this account (format as YYYY-MM-DD), the preset value is permanently valid
  • -Example of f inactive_time:

Online Examples

Add a general 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 group of the user 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/Home Directory

# useradd-d /home/myf kk //The home directory of the newly added user kk is/home/myf
//When the user kk logs in to the host, the default directory entered by the system is/home/myf

Linux Command大全