useradd vs. adduser: What Are the Differences?

September 1, 2022

Introduction

Both useradd and adduser commands create new users on a Linux system. Although the two commands perform a similar task, the execution method is different.

Whether you're just testing how the system works or if you're a system administrator that handles user provisioning, knowing how useradd and adduser work is crucial in choosing between the two commands.

This guide outlines the main differences between useradd and adduser commands and when to use them.

useradd vs. adduser: What Are the Differences?

Prerequisites

  • Access to the terminal.
  • A sudo user to run the commands.

What is useradd Command?

useradd is a Linux command for creating a new user. It requires various options to add and set up an active user account. Additionally, the command allows changing default values for the user creation process.

useradd is a low-level, portable command available on all Linux distributions.

useradd Example

To see how useradd works, run the following command in the terminal:

sudo useradd <username>

Replace <username> with a name for the new user. For example:

sudo useradd test_user terminal output

After entering the sudo password, the command creates a new user with the username test_user and doesn't produce an output. useradd automatically applies preconfigured options from the /etc/useradd file. However, the user requires additional setup with the passwd command to use the account.

To view all the available options, use the -h tag:

useradd -h
useradd -h terminal output

Alternatively, use the man command to view the complete manual page.

What is adduser Command?

The adduser command creates a new user on a Linux system through an interactive prompt. The high-level wrapper is written in Perl and is a front-end for useradd.

Running the command creates a home directory, adds the default shell as Bash, and prompts the user to enter a password to unlock the account.

However, the command doesn't provide much control over the user creation details. Additionally, adduser is unavailable on all Linux distributions and, therefore, not portable.

adduser Example

To see how adduser works, run the following command in the terminal:

sudo adduser <username>

Replace <username> with a name for the new user. For example:

sudo adduser test_user terminal output

The command starts a program that guides the user through the creation process in an interactive interface. The command creates an active user account on the system.

To view all the options with brief descriptions for the adduser command, run:

adduser -h
adduser -h terminal output

useradd vs. adduser

The main difference between the useradd vs. adduser commands is in how the two commands execute:

  • The useradd command is lower level and available on all Linux distributions. It requires additional parameters to set up the account entirely.
  • The adduser command is higher level and not available on all Linux distributions. The command adds a user to the system with standard settings.

useradd vs. adduser: Which One Should You Use?

The useradd and adduser commands add a new user to the system but differ in execution.

The adduser command is convenient for setting up a regular user with standard presets, such as a password and Bash shell. adduser provides guides through the user creation process in an interactive prompt. Therefore, the adduser command is a beginner-friendly way to add a new user.

The useradd command provides complete control over the user creation process. With additional options, useradd achieves the same tasks as adduser. As an additional benefit, the command is portable across different Linux systems and more convenient for Bash scripting.

Note: Regardless of how the user was created, you can modify an existing user with the usermod command.

Conclusion

After reading about the differences between the useradd and adduser, you know when to use which command. Both commands add a user account to a Linux system, and adduser serves as a front-end for useradd.

Next, check out our Linux command cheat sheet, which features more commands for users and groups.

Was this article helpful?
YesNo
Milica Dancuk
Milica Dancuk is a technical writer at phoenixNAP who is passionate about programming. Her background in Electrical Engineering and Computing combined with her teaching experience give her the ability to easily explain complex technical concepts through her content.
Next you should read
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...
Read more
How to List Users in Linux
August 4, 2022

Linux OS is unique because of its multiuser characteristic. It allows multiple users on one system, at the same time. In such circumstances, it is...
Read more
How to Create/Add Users in Linux
July 26, 2022

The useradd command is the primary SysAdmin tool for creating new user accounts on a Linux system. This guide provides and in-depth explanation...
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...
Read more