This post shows students and new users the steps to add or remove users on Ubuntu Linux. Whether you are a system administrator managing a server or a home user working at an Ubuntu desktop, adding new users to Ubuntu is something you might want to learn how to do.

By default, after installing Ubuntu Linux, the first account created during installation is the primary user of the systems. This user can perform administrative tasks as root using the sudo command.

By default, the root user account is disabled. There are no other active user accounts. Therefore, to provide exclusive access to a user, you must create an account for him or her. A service can also have an account, in cases where it needs to perform account-related tasks.

Also, for students and new users learning Linux, the easiest place to start learning is Ubuntu Linux. Ubuntu is the modern open source Linux operating system for desktops, servers, and other devices.

In Ubuntu, there are two command line tools that you can use to create a new user account: useradd and add user.

On Ubuntu Linux, the useradd The tool is a low-level utility. add user is a script that acts as a friendly interactive interface for useradd.

How to add a user from the command line

Adding a new user in Ubuntu from the command line is relatively quick and easy. To create a new user, simply invoke the add user command followed by username.

For example, to create a new user account called octopus you would run the following commands:

sudo adduser octopus

When you run the above commands, you will be asked a series of questions about the details of the account you are creating. You will have to enter and confirm a password, but providing answers for others is optional.

Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for octopus
Enter the new value, or press ENTER for the default
	Full Name []: 
	Room Number []: 
	Work Phone []: 
	Home Phone []: 
	Other []: 
Is the information correct? [Y/n] Y

If the information you entered is correct, write AND to create the account.

With the account being created, if you want to make the account an administrator or allow the account to make changes to the machine, you will need to add the user to the sudo group.

Run the following commands to do so.

sudo usermod -aG sudo octopus

This is how a user is created in Ubuntu Linux via the command line terminal.

How to add a user on the Ubuntu desktop

If you are using an Ubuntu desktop, the above steps can be done using the desktop applications. First login to Ubuntu and follow the steps below:

Click on the top System Menu and select Settings as shown in the picture below.

creating new ubuntu user

Then scroll down to Users from the item menu and select.

ubuntu new user creation 1

Then click to unlock at the top right to allow you to edit or create new user accounts.

ubuntu new user creation 2

The unlock button becomes Add users. To add a new user, click Add users and provide the user account details.

ubuntu new user creation 3

Then provide the full name of the user, as well as the username and password.

ubuntu new user creation 4

When you’re done adding your account details, click Add as shown above.

If you want the account to be a member of the administrators group, click the Administrator tab to add the user to the group.

How to delete a user in Ubuntu Linux

In Ubuntu, you can use two commands to delete a user account: userdel and its friendly interactive interface tool: scam.

To delete the sample user created earlier, run the following commands:

sudo deluser octopus

The above command will delete the user but not their files. To delete the user and files, run the following commands.

sudo deluser --remove-home octopus

With the Ubuntu desktop, the same can be done from the user settings window above. Select the user account and click Remove.

You should do that!

Conclusion:

In this tutorial we have seen how to add or remove a user in Ubuntu Linux. If you find any errors above or have something to add, please use the comment form below.

Write A Comment