Linux adduser Command with Examples

November 17, 2022


The adduser command in Linux creates a new user or group. By applying various options, adduser allows customizing settings in the user provisioning process. The command is a high-level interface for useradd and features interactive prompts when creating new accounts.

This article shows how to install and use the adduser command in Linux.

Linux adduser Command With Examples


  • A system running Linux.
  • Access to the command line/terminal.
  • Access to the root user or a sudo user.

Install adduser

The adduser command is not available by default on all Linux systems. To install the adduser program, run one of the following commands for the appropriate OS:

  • Ubuntu/Debian:
sudo apt install adduser
  • CentOS/RHEL:
sudo yum install adduser

Check that the command is available after installation with the following:

adduser --version
adduser version terminal output

The output shows the program version and the license details, indicating a successful installation.

adduser Syntax

The basic syntax for the adduser command is:

sudo adduser <options> <username>

By default, the command adds a user based on the preconfigured options in the /etc/adduser.conf file.

Linux adduser Options

The adduser command has several working modes and behaves differently based on specified options and parameters. Below is a table with commonly used options and their descriptions.

--systemAdds a system user or group.
--conf <file>Uses <file> instead of the /etc/adduser.conf.
--disabled-loginDisables logging into the user account.
--disabled-passwordDisables logging in using a password.
--gid <ID>Sets the group ID number to <ID>. If the user is specified, it also adds the user to the group.
--groupRuns the addgroup command and adds a user group. If --system is specified, it adds a system user and group.
--home <directory>Sets the user's home directory to <directory>.
--shell <shell>Uses <shell> as the user's login shell.
--ingroup <group>Adds user to <group> instead of the default group in the configuration file.
--no-create-homeAvoids creating the home directory for the user.

For a full list of options and details, use the man command.

adduser Examples

Running the adduser command starts interactive prompts, which guide you through the user creation process. The results of the adduser command depend on the specified options.

Add a Regular User

The most basic way to use the adduser command is without any options. For example:

sudo adduser <username>

The command automatically:

  • Creates the user with the provided username and the first available UID (1000 and greater).
  • Makes a group with the same name and uses the first available GID.
  • Adds the user to the group.
  • Creates a home directory for the user (/home/<username>).
  • Starts the passwd command to set up the user's password.
  • Asks for additional user details.
sudo adduser test terminal output

The newly created user appears on the user list in the /etc/passwd file. List all users and grep the new user with the following command:

sudo cat /etc/passwd | grep <username>
test user in /etc/passwd file output

The output lists the user entry and all the additional user information.

Add a System User

System users are non-login user accounts used for installation processes and services. To add a system account, use the following syntax:

sudo adduser --system <username>
sudo adduser system test terminal output

The command does the following:

  • Creates a new system user with the first available system UID (1-999).
  • Adds the user to the nogroup group.
  • Creates a home directory for the user (/home/<username>).

The system user appends to the /etc/passwd file.

Add Group

The adduser command with the --group option adds a new group to the system. The combination invokes the addgroup command. For example:

sudo adduser --group <group name>
sudo adduser --group test terminal output

The command is the same as running the following:

sudo addgroup <group name>
sudo addgroup test terminal output

Adding the --system option creates a system user and group with the same name. For example:

sudo adduser --group --system <name>
sudo adduser group system test terminal output

The UID and GID are between 1 and 999, indicating it is a system user and group.

Add User Password Options

Additional adduser options allow overriding the default password rules set in /etc/adduser.conf.

For example, to avoid setting a password during user creation, run:

sudo adduser --disabled-login <username>
sudo adduser disabled login terminal output

The command does not request setting up a password and disables logging into the account until using the passwd command.

To disable password login for the user, use the following command:

sudo adduser --disabled-password <username>
sudo adduser disabled password terminal output

If you disable password login, use SSH, for example, to access the system with your account.

Note: To modify existing users, use the usermod command.

Add a User With a Custom Shell

To set the default login Linux shell for the user, use the --shell option and provide the path:

sudo adduser --shell=<shell path> <username>
sudo adduser shell fish terminal output

The provided shell overrides the default options and becomes the login shell for the given user.

Add a User Home Options

To add a user and set a custom home directory path, run the following:

sudo adduser --home <directory> <username>
sudo adduser home terminal output

Use this option to have different users share a home directory location.

Alternatively, to create a user without creating a home directory, run the following:

sudo adduser --no-create-home <username>
sudo adduser no create home terminal output

The command avoids creating a home directory for the user, which is suitable for system users.


You've learned how to use adduser to add new users to a Linux system. The adduser command is a simple and user-friendly way to add new accounts.

Next, see the detailed comparison between the useradd and adduser commands.

Was this article helpful?
Milica Dancuk
Milica Dancuk is a technical writer at phoenixNAP with a passion for programming. With a background in Electrical Engineering and Computing, coupled with her teaching experience, she excels at simplifying complex technical concepts in her writing.
Next you should read
Linux Commands All Users Should Know {Ultimate List}
October 4, 2022

This article contains a list of commands all Linux users should know. Whether you're new to Linux or...
Read more
How to Add a User to a Linux Group
August 19, 2022

By following the steps in this tutorial you will learn how to add a user to a group in Linux. Read the easy steps and learn how to expand your team. You will learn how to manage...
Read more
How to Use the usermod Command in Linux
March 4, 2021

The usermod command modifies user account details: username, password, home directory location, shell, and more. This tutorial...
Read more
How To Use The Passwd Command In Linux
January 26, 2021

Passwords are the most important feature of security. This article explains and shows examples of how to use the passwd command in Linux to manage...
Read more