How to Add and Remove a User on Ubuntu Linux

doctor 4187242 640

This post shows students and new users steps to add or remove users on Ubuntu Linux. Whether you’re a system administrator managing a server or a home user working on a 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 the installation is the primary user of the systems. This user is able to run administrative tasks as root using the sudo command.

By default, the root user account is disabled. No other user accounts are active. So in order to provide unique 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 on Ubuntu Linux. Ubuntu is the modern, open source Linux operating system for desktop, servers and other devices.

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

In Ubuntu Linux, the useradd tool is a low-level utility. adduser is a script that acts as a friendly interactive frontend for useradd.

How to a add User from the command line

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

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

sudo adduser octopus

When you run the commands above, you’ll be asked series of questions about detail of the account you’re creating. You’ll have to enter and confirm a password, but providing answers for the 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, type Y 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’ll need to add the user to the sudo group.

Run the commands below to do so.

sudo usermod -aG sudo octopus

That’s how one creates a user on Ubuntu Linux via the command line terminal.

How to add a User on Ubuntu Desktop

If you are using a Ubuntu desktop, the steps above can be done using the desktop apps. First logon to Ubuntu and follow the steps below:

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

ubuntu new user creation

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

ubuntu new user creation 1

Next, click 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 new user, click Add Users and provide the user account details.

ubuntu new user creation 3

Then provide the user Full Name as well as the username and password.

ubuntu new user creation 4

When you’re done adding the account details, click Add as shown Above.

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

How to delete a user on Ubuntu Linux

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

To delete the example user created above, run the commands below:

sudo deluser octopus

The command above will delete the user but not his/her files. To delete the user and files, run the commands below.

sudo deluser --remove-home octopus

Using Ubuntu desktop, the same can be performed from the User settings window above. Select the user account and click Remove.

That should do it!

Conclusion:

This post showed you how to add or remove a user on Ubuntu Linux. If you find any error above or have something to add, please use the comment form below.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.