Easy Tutorial
❮ Linux Comm Finger Linux Comm Getty ❯

Linux useradd Command

Linux Command Manual

The Linux useradd command is used to create user accounts.

useradd can be used to create user accounts. After the account is created, use passwd to set the account's password. The userdel command can be used to delete the account. The accounts created using the useradd command are actually stored in the /etc/passwd text file.

Syntax

useradd [-mMnr][-c <comment>][-d &lt;login directory>][-e &lt;expiry date>][-f &lt;inactive days>][-g <group>][-G <groups>][-s <shell>][-u <uid>][username]

or

useradd -D [-b][-e &lt;expiry date>][-f &lt;inactive days>][-g <group>][-G <groups>][-s <shell>]

Parameter Description:

Examples

Add a regular user

# useradd tt

Specify a user group for the added user

# useradd -g root tt

Create a system user

# useradd -r tt

Specify a home directory for the new user

# useradd -d /home/myd tt

Create a user with a specified ID

# useradd caojh -u 544

Linux Command Manual

❮ Linux Comm Finger Linux Comm Getty ❯