How to Add and Delete Users on Ubuntu 24.04

In Linux systems, including Ubuntu 24.04, a user is an account that is associated with an individual or process. Each user created on a system has a username and a numeric user ID, generally called UID. The username is a unique ID assigned to each user that helps them identify and authenticate users when they log in. Each user can log into the system with their username and password, and run commands, access files and perform other system related tasks. 

By creating a separate user account on Ubuntu, you can limit the risk associated with running tasks as a root user. The reason is the user will get limited privileges, thus reducing the chance of accidentally damaging the system that can occur if you are a root user. Further, creating a new user will also create a new home directory, where a user can store their personal files, configurations and settings. 

This guide will provide a complete guide to add and delete users on Ubuntu 24.04.


Types of Users on Ubuntu 24.04

Before we dive into the process of adding or deleting users, first know about the types of users on Ubuntu. There are generally two types of users on Linux, including Ubuntu 24.04, one is the regular users created by the administrator used to interact with the system directly. They run applications, login, and perform various tasks. Each regular user has a unique username and corresponding folder for storing personal files and configurations. By default, the regular users have limited privileges, means such types of users cannot modify system files or perform administrative tasks without having sudo privileges. 

On the other hand, the system users are created automatically during software or service installation, like daemon users, service users, default system users, and more. These users have a typical ID (UID) below a threshold value (1000) that distinguishes them from other regular users on the system.

Throughout this guide, we will focus on adding or deleting regular users on Ubuntu 24.04.  

How to Add Users on Ubuntu 24.04

You can add users on Ubuntu 24.04 from: 

  • Terminal 
  • GUI

How to Add Users on Ubuntu 24.04 from Terminal

You can add users on Ubuntu from the terminal through two commands, which are as follows:

  • adduser Command
  • useradd Command

Let’s discuss these commands in detail.

Adding Users from Terminal Using the adduser Command

The adduser command is a widely used command that allows you to add a new user or group to your Linux system, including Ubuntu 24.04. It provides an interactive prompt when creating a user account on the terminal. Only thing you have to do is to open your terminal and run the adduser command with sudo privileges followed by the username you want to add on Ubuntu. The syntax to add a new user to Ubuntu with the adduser command is provided below:

sudo adduser username

Here, we are creating a user ilf_ubuntu on the system using the following command:

sudo adduser ilf_ubuntu

When you run the adduser command, a prompt will appear that asks from you to add a new password for your new username

Enter the password, retype it, then enter the new value for your username according to your desire. You can simply press Enter on each value to go for the default one:

Finally, complete the process by replying with Y to ensure the information you provided earlier is correct:

At this stage, we have successfully added a new user account on the Ubuntu system.

To verify that the new user is successfully added to the system, you can use the following command:

grep username /etc/passwd

If you want to add a system user to the Ubuntu system with adduser command, you can do it quite easily through the below-given syntax:

sudo adduser --system username

To add a user account with a disabled-login feature, you can use the following syntax:

sudo adduser --disabled-login username

Doing this will permit others to log in to your username using the password. Instead, other means of login, such as SSH keys, will be required in case you have created the users through the above command. 

You can also use the –disabled-password flag in place of –disabled-login with the adduser command to create a user without setting a password.

sudo adduser --disabled-password username

The following are some additional flags mentioned in the table that you can use with the adduser command to create a new user on Ubuntu according to your desired needs.

Flags or OptionsDescription
–gid <ID>Sets the group ID number to <ID>
–home <directory>Sets the user’s home directory.
–groupAdds a user group. Use it with the command for adding system users.
–shell <shell>Specifies the user’s login shell.
–no-create-homeAvoids creating the home directory.

Add Users from Terminal Using the useradd Command

The useradd command is another useful command that can be used to add a new user on Ubuntu. This command is not as powerful as adduser command because it doesn’t automatically create a home directory or set a user password. However, you can still use it to create a user on Ubuntu according to your desired needs. 

For adding a user to Ubuntu from the terminal using the useradd command, use the below-given syntax:

sudo useradd username

Here, we have created a user its_linuxfoss on Ubuntu using the following command:

sudo useradd its_linuxfoss

To display the ID and group information of your newly created user, you can use the following syntax by replacing the username with your desired user account.

sudo id username

As already mentioned, the useradd command doesn’t set the password for your user account. However, you can set the password manually by using the following syntax:

sudo passwd username

You can also modify the useradd command by adding the -m flag followed by the username to ensure it creates a home directory for your desired username. The syntax to add a user with home directory on Ubuntu is proved below:

sudo useradd -m username

To verify that the above command successfully creates a home directory for your newly added users, use the below-given syntax:

sudo ls -la /home/username/

How to Add Users on Ubuntu 24.04 from GUI

If you are using Ubuntu 24.04 desktop, you can easily add user from the main Settings of your system, it can be done by going through the following steps:

Step 1: First, go to system’s settings either from the task bar or Application menu:

Step 2: Then scroll down, navigate to the System section, and then choose the Users option:

Step 3: Unlock the settings using the Unlock button and typing your default password for the current user:

Step 4: Scroll down and click the Add User button:

Step 5: Fill in the desired options like username according to your choice, enable the Administrator option, set password now and add your password. Once done, click the Add button:

This will add a new user to Ubuntu from GUI with the sudo privileges. 

How to Add a User to sudo Group on Ubuntu 24.04

By default, the user created on Ubuntu through the adduser or useradd commands doesn’t have sudo privileges to run system-related commands. Therefore, when you switch to your user and run the commands with sudo mode, you will get the error “username not in the sudoers file”.

To solve this error and add a user to sudo group on Ubuntu, you can:

  • Use the usermod Command
  • Add a User Entry into the sudoers File

Adding a User to sudo Group Using the usermod Command

To add a user to a sudo group and give sudo privileges to the user, you can use the usermod command provided below:

sudo usermod -aG sudo username

Ensure changing the username with your desired user account that you want to add to the sudo group. Here, we are adding a user ilf_ubuntu to sudo group using the following command:

sudo usermod -aG sudo ilf_ubuntu

To ensure the user is added to the sudo group, you can switch back to the user which was not added to the sudo group previously. Then run any command with sudo privileges to ensure the error “username not isn’t the sudoers file” is resolved on Ubuntu.

Adding a User to sudo Group Using the sudoers File

Besides using the usermod command for adding a user to the sudo group on Ubuntu, you can also edit the sudoers file to perform the similar task. The sudoers file is a system related file that controls how sudo works on your system, and determines the ability of a specific user or group to run commands as a superuser. 

You can open sudoers file on Ubuntu using the below-given command:

sudo nano /etc/sudoers

Inside the sudoers file, scroll down and add the following line below the “user privilege specification”:

username ALL=(ALL:ALL) ALL

Note: Replace username in the above line with the username you want to add to the user group on Ubuntu.

Once done, save the sudoers file using keys combination CTRL+X, then add Y and finally press Enter to exit; this will add your user to the sudo group. 

Alternatively, you can open the sudoers file on Ubuntu through the following command as well:

sudo visudo

How to Delete User from Ubuntu 24.04

Like adding the user on Ubuntu from GUI and terminal, you can also use both GUI and terminal to delete users from the system. 

From the terminal, you can delete the user from Ubuntu using the below-given deluser command:

sudo deluser username

Here, we have deleted a user its_linuxfoss from Ubuntu using the deluser command:

You can also delete the user with its desired home directory by running the below-given command:

sudo deluser --remove-home username

Note: Also, don’t forget to remove the line from the sudoers file you added for your desired username for adding it to the sudo group.

To remove a user from Ubuntu through GUI, simply navigate to the System>Users settings again, click on the desired username you want to delete:

Click on the Remove User button:

Then enable the Delete Files and Settings option and click on the Remove button to delete the user from Ubuntu 24.04 with all files and settings:


Adding a user on Ubuntu is a useful task for effective system management. You can add users on Ubuntu 24.04 from GUI and terminal. The GUI method is simple and allows you to quickly add a user with the sudo privileges on your system. For the terminal method, you can use the adduser and useradd commands to add a user. The adduser command is more effective, allowing you to quickly add a user with password and home directory. However, for the useradd command, you have to set a password and create a home directory separately (or use -m flag). The terminal method also requires adding the user to the sudo group, which can be done using the usermod command or adding an entry in the sudoers file. 

Further, you can use the deluser command followed by the username to quickly delete users from the Ubuntu system. Or you can open the system’s settings and delete users from there one by one according to your choice.