How to add new users to your Linux machine

If you need to add a new user to Linux, Jack Wallen is here to assure you the task isn't even remotely challenging.
Written by Jack Wallen, Contributing Writer

Linux is a multi-user environment where numerous user accounts can be added and used like most operating systems. However, you might be surprised by how easy it is to create a new user on Linux. To illustrate this, I'm going to walk you through the steps of adding a new user with both a GUI tool and from the command line interface (CLI). Both methods are simple and can be done by anyone with just about any skill level.

Don't believe me? Let's get to work and find out.

I'll be demonstrating first on Ubuntu Desktop 22.04 and then Ubuntu Server 22.04, but the process is quite similar, regardless of the distribution you choose. As far as the GUI environment, every desktop does use a variation on the theme, but once you can create a user from within Ubuntu, you should be able to easily translate that to the like of KDE, Xfce and nearly any of the many Linux desktops.

Also: How to install Ubuntu Linux (It's easy!)

From the desktop

1. Open Settings

Log into Ubuntu and open the Settings tools, which can be found within the Applications Overview (Figure 1).

The Ubuntu Desktop Applications Overfiew.

Figure 1

The Ubuntu Applications Overview makes it easy to locate the application you need.

Image: Jack Wallen

2. Locate Users

In the left sidebar, scroll down until use see Users (Figure 2).

The Ubuntu Desktop Settings window.

Figure 2

The Users listing is found in the Ubuntu Settings app.

Image: Jack Wallen

Click Users and then click Unlock so you can make changes (Figure 3).

The Ubuntu Desktop add users window.

Figure 3

Unlocking the Users section so new users can be added.

Image: Jack Wallen

3. Add a new user

Click Add User at the top of the screen and then, in the resulting popup (Figure 4), fill out the information for the new user.

The new users details window.

Figure 4

Adding a new user in Ubuntu Desktop Linux.

Image: Jack Wallen

You can then either allow the user to create their own password (they'll be prompted at first login), or you can set a password for them. If this user needs Admin privileges (so they can do things like install software), click the Administrator button, and they'll be added to the sudo group. 

Click Add, and the user is set for their first login.

From the command line

1. Log into your server

The first step is to log into your Linux server, either using SSH or, if you have physical access to the server, from the terminal itself. 

2. Add the new user

Once you've logged in, create a new user with the command:

sudo adduser USERNAME

Where USERNAME is the name of the user to be added. You'll be prompted to create a new password for the user, followed by full name, room number, work phone, home phone, and other. You can skip these details (although I would suggest at least adding the full name). After entering the details, you'll be prompted to OK the new user by typing Y.

3. Giving the new user admin privileges

If you've added the new user from the command line, and you want to give that user admin privileges, you must add them to the sudo group (if you're using a Red Hat-based distribution, that group is wheel). To do this, issue the command:

sudo usermod -aG sudo USERNAME

Where USERNAME is the name of the user, you just added.

4. Forcing the new user to change their password

At that point, the new user can log in with the password you set for them. If you want to force them to change their password upon first login, you could issue the command:

sudo passwd -e USERNAME

Where USERNAME is the new username you just added.

And that's all there is to add a new user in Linux, from both the GUI and the command line. As I said, once you know how to add a user from within the Ubuntu GUI, you shouldn't have much trouble doing so with any desktop. If you do run into trouble with your GUI, you can always turn to the command line option, which is universal for all Linux distributions.

Editorial standards