How to add a user in Linux using useradd command

To add a new user in Linux, use the useradd command. The basic syntax is useradd <username>. The username is the only information required to add a new user, but there are different options available for this command.

The useradd command creates the account, but the account is locked. To unlock the account and create a password for the user, use the command passwd <username>.  

By default, the user’s home directory is created and the files from /etc/skel/ are copied into it.

Some important options for useradd command are listed below.



-c <full_name>

Full Name of the user

-d <home_dir>

Home directory of the user

-g <group>


Default group for the user specified as a group name or group ID number. The group name or GID must already exist. The default is to create a private user group. If a private user group is not created, the default is the users group.

-G <groups>

Comma-separated list of additional group names or GIDs to which the user will be a member. Groups must already exist.


Create a home directory for the user if it doesn’t exist. Files from /etc/skel/ are copied into the home directory.


 Do not create a private user group for the user. By default, a private user group is created for the user.

-p <password>

Specify an encrypted password for the user. By default, the account is locked until the passwd command is used to set the user’s password. You may use openssl command to create an encrypted password.

-s <shell>

Specify the user login shell for the user. The default shell is /bin/bash.


[root@localhost ~]# useradd tintin

Related Tutorials
• Introduction to Linux user administration
• How to use passwd command to manage user passwords
• How to modify a Linux user using usermod command
• How to set Linux password aging using chage command
• How to remove user from Linux using userdel command
• The Linux user database (/etc/passwd)
• The Linux password database (/etc/shadow)
• Introduction to Linux User Group
• How to create a new group in Linux using groupadd command
• Linux Group Database (/etc/group) file
• How to manage Linux user group