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

Linux useradd Command

Linux useradd Command

Linux Command Reference Linux Command Reference

The Linux useradd command is used to create user accounts.

useradd can be used to create user accounts. After an account is created, use passwd to set its password, and use userdel to delete the account. Accounts created with the useradd command are actually stored in the /etc/passwd text file.

Syntax

useradd [-mMnr][-c <备注>][-d <登入目录>][-e <有效期限>][-f <缓冲天数>][-g <群组>][-G <群组>][-s ][-u ][用户帐号]

or

useradd -D [-b][-e <有效期限>][-f <缓冲天数>][-g <群组>][-G <群组>][-s ]

Parameter Description:

Example

Add a regular user

# useradd tt

Assign an appropriate user group to the added user

# useradd -g root tt

Create a system user

# useradd -r tt

Specify the home directory for a newly added user

# useradd -d /home/myd tt

Create a user with a specified ID

# useradd caojh -u 544

Linux Command Reference Linux Command Reference