How to Make a User an Administrator in Ubuntu

If you have more than one user on your Linux system, you may not want all of them to perform administrative tasks or mess up private system settings. In this case, you can avoid giving these users administrative rights in Ubuntu. Unauthorized users won’t be able to install or uninstall software on your system, and they won’t be able to change important system settings and configurations. Even if you are not at your computer, unauthorized users cannot perform these tasks because they all need sudo privileges and must know the password for sudo.

However, if you want to grant administrative privileges to a user, this article is for you.

In this article, I describe how to make a user an administrator through the graphical user interface and explain what commands you need to use on the command line to add a user to the sudo (authorized) user group.

We have run the commands and procedures mentioned in this article on an Ubuntu 20.04 and Ubuntu 22.04 system.

Make a User an Administrator in Ubuntu Through the GUI

In order to change user settings through the UI, you need to open the Users tab in the System Settings utility. You can access it through the following two ways:

Enter the ‘users’ keyword in the system Dash and click on the “Users” search result.

Users settings

Or

Click on the downward arrow located in the top-right corner of your Ubuntu desktop, click on your username in the following view and then click Account Settings from the drop-down.

Account Settings

The Settings utility will open, displaying the Users tab. Please note that only an authorized user can change user settings in Ubuntu. First, you need to unlock the tab in order to make changes as an administrator by clicking the Unlock button located in the top-right corner of the Users view:

Users view

This will open the following Authentication dialog where you can provide the password for the authorized user:

Get sudo permissions

Enter the password and then click the Authenticate button. Now you can make changes to any user’s settings. Click on the username of the user you want to make an Administrator.

User details

In the Account Type of the user you will see two buttons; the Standard button and the Administrator button. Click on the Administrator button to make this user an Administrator. As soon as you do this, the user will be given administrative privileges and can now perform all operations that need root rights.

Make a User an Administrator in Ubuntu Through the Command Line

We will describe two ways to make a standard Ubuntu user an Administrator through the command line:

  • Through the usermod command
  • Through the gpasswd command

We will use the Ubuntu command line application, the Terminal, to perform this operation. You can open the Terminal either through the system Dash or the Ctrl+Alt+T shortcut.

Method 1: The usermod command

Open the Terminal and enter the following command as sudo as only an authorized user can edit user settings in Ubuntu:

Syntax:

$ sudo usermod -aG sudo “username”

Example:

In this example we will use the following command to make a user with the username “sampleuser” an administrator:

$ sudo usermod -aG sudo sampleuser

Use usermod command to give admin rights to a Ubuntu user

Enter the password for sudo and the user will be added to the “sudo” group which means that he/she can perform all administrative tasks on Ubuntu.

You can verify that the user is now in the “sudo” group by checking the groups a user belongs to, through the following command:

$ groups “username”

The following output of the ‘groups’ command for our “sampleuser” indicates that he/she is now part of the sudo group.

Check sudo permissions

Method 2: The gpasswd command

Open the Terminal and enter the following gpasswd command as sudo as only an authorized user can edit user settings in Ubuntu:

Syntax:

$ sudo gpasswd -a “username” sudo

Example:

In this example, we are adding the “sampleuser” to the sudo group through the following command:

$ sudo gpasswd -a sampleuser sudo

Use gpasswd command to make user and admin

You can also remove a user from the sudo group through the -r switch in the same gpasswd command:

Syntax:

$ sudo gpasswd -d “username” sudo

Example:

In this example, we are removing the “sampleuser” from the sudo group through the following command:

$ sudo gpasswd -a sampleuser sudo

Remove user from sudo group

Through the methods described in this article, you can make an ordinary Ubuntu user an Administrator so that they can perform all tasks that require root privileges on the system.

How to Make a User an Administrator in Ubuntu