How to Add Users in Ubuntu Server

Want to know how to add a user to Ubuntu server? It turns out there are two different ways to accomplish this task – useradd and adduser. Both are good ways of creating new users for your server. In this article we’ll go over both methods as well as how to add users to groups, set up sudo, and even delete users!

Note: In this article we’ll be using maketecheasier as the user. When you set this up, be sure to change it to your own username. Also, the method listed below will work in any Linux distro. Ubuntu is only used as an example.

Creating a new user with the useradd command can be done very easily and has a lot of different switches and flags in order to set the user up in a certain way. For example, if you wanted to create a user without a home directory or anything, you’d create it like this.

useradd maketecheasier


However, if you want your user to be set up with a home directory and added to some specific groups you need, you’ll need to do a little something like this:

useradd -m -g users -G sudo -s /bin/bash maketecheasier

The useradd command is a native tool that’s included with Linux. It’s powerful and certainly not as user-friendly as the adduser command. However, when you’re making a user on Ubuntu server, power is often more important than being user-friendly.

Using adduser to set up a user can be useful, especially for users who need something a bit more user-friendly. The reason for this is when you create a user with this command, it often prompts the creator to set up basic information and specify certain things during its creation out of the gate. This is in contrast to useradd.

In a terminal enter the following:

sudo adduser maketecheasier


When you create a user with this command, you’re able to fill out things like profile information, phone number, first name and last name, along with many other useful bits of personal information.

Adding users to a group is an essential part of controlling what your users can do with the system. If you want to add a user to a particular group, you’ll need to first figure out what groups are on the system. This can be done in the terminal with one or two commands.

If you want to list every group on the system, try this command:

cut -d: -f1 /etc/group | more


Note: you can also create a new group by using groupadd groupname.

This will print out a list of every single group on the system. From here, you’ll be able to decide exactly what groups your user needs to be added to. Want to figure out what groups the current user is added to already? Try groups in the terminal.


Adding a user to a group is easy once you know the name of the group. In this example, we’ll show you how to add a user to the sudo group so that your newly-created user can execute sudo commands.

Enter the following command to add the user to the sudoer group:

Note: you should probably run this command as root or as another user that can sudo.

usermod -a -G sudo maketecheasier

If you’re looking to delete your newly created user, or just a user you have on Ubuntu server that you want to get rid of, here’s how you do it.

In a terminal, enter:

sudo userdel maketecheasier

This will delete your user. If you want to also delete the user’s home directory, you’ll need to add the -r switch to the end of the command. You should also consider adding -f to force the files to be deleted in case the directories refuse to delete.

When it comes down to it, the only real difference between useradd and adduser is its implementation. At the end of the day, with one you’re filling out all the information in a prompt, and with the other you’re using different flags and switches to ensure your user is set up the way you want. Both work great for the use-case they were created for.

What do you prefer to use, adduser or useradd? Let us know below!

Image credit: Server room

Leave a Reply

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.