Linux adduser command - add new user account

Every Linux user must learn how to create a new user account in Linux system. There should be at least one normal user account in your system. You can't continue using root to learn Linux. It's dangerous because root is a super power user. Some serious mistakes can damage your Linux system. This tutorial will guide user adding new Linux user account using adduser command. This account will be your main account and next time you login into your Linux system, use this account instead of root.

Create new user account using Linux adduser command in Slackware

The command used to create a new user account in Linux and Unix-based operating system is useradd command. In Slackware however, we normally add user account using adduser command. The adduser command has been simplified and made adding a new account in Linux system easier. Here is a part of adduser description from manual page:

DESCRIPTION
adduser and addgroup add users and groups to the system according to
command line options and configuration information in
/etc/adduser.conf. They are friendlier front ends to the low level
tools like useradd, groupadd and usermod programs, by default choosing
Debian policy conformant UID and GID values, creating a home directory
with skeletal configuration, running a custom script, and other features.
adduser and addgroup can be run in one of five modes:

Let's try adding a new user account using adduser command and see how easy it is. Switch to a new command line terminal and login as root. Type adduser and press Enter. See example below:

[email protected]:~# adduser

Login name for new user []:

What important here is login name part. It is the name of the new user account. Type a simple one word name with no white space. You can put real name later. Enter other information related to the Linux system for the new user. If you are not sure just press enter to use the default value.

Login name for new user []: jadon
User ID ('UID') [ defaults to next available ]:
Initial group [ users ]:
Additional groups (comma separated) []:
Home directory [ /home/jadon ]
Shell [ /bin/bash ]
Expiry date (YYYY-MM-DD) []:

Press Enter each time you finish entering information. Don't worry about the user information yet. You can always add or edit them later with Linux usermod command. For now, just enter what's important. You'll get a summary of the new user account information that you provided just now.

New account will be created as follows:

---------------------------------------
Login name.......: jadon
UID..............: [ Next available ]
Initial group....: users
Additional groups: [ None ]
Home directory...: /home/jadon
Shell............: /bin/bash
Expiry date......: [ Never ]

This is it... if you want to bail out, hit Control-C. Otherwise, press
ENTER to go ahead and make the account.

You can cancel the new user account with Ctrl+c key. When you are ready, press Enter to continue making the account. In the next section, you have to provide information about the new user. The most important here is to set a password for the new account. See example below:

Creating new account...

Changing the user information for jadon
Enter the new value, or press ENTER for the default
Full Name []: jadon java
Room Number []: 13
Work Phone []:
Home Phone []:
Other []:
Changing password for jadon
Enter the new password (minimum of 5, maximum of 127 characters)
Please use a combination of upper and lower case letters and numbers.

New password:
Re-enter new password:
Password changed.

Account setup complete.

Your new user account setup is complete now.

Create new user account with adduser command in Ubuntu Linux

You can also using adduser command in Ubuntu to create a new user account. It is even simpler than Slackware. Here is an example of creating a new user account in Ubuntu server using adduser command:

[email protected]:~$ sudo adduser umar
Adding user `umar' ...
Adding new group `umar' (1005) ...
Adding new user `umar' (1004) with group `umar' ...
Creating home directory `/home/umar' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for umar
Enter the new value, or press ENTER for the default
Full Name []: umar hakimi
Room Number []: 133
Work Phone []: 012345678
Home Phone []: 019123456
Other []: 0312345678
Is the information correct? [y/N] y
[email protected]:~$

The adduser command in Ubuntu is slightly different from Slackware. In Ubuntu, you must provide a login name after the adduser command. After that Ubuntu automatically add default group and create a home directory for the new account. Everything else is the same as Slackware.

Back to Linux basic commands main page.

Add new comment