How to assign admin rights to users in Ubuntu

This article will describe how to make a user admin via 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.

The commands and processes mentioned in this article are performed on Ubuntu 20.04 and Ubuntu 22.04 systems.

Make user admin in Ubuntu via GUI

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

Enter the keyword users into the system Dash and click on the Users search result.

How to assign admin rights to users in Ubuntu Picture 1How to assign admin rights to users in Ubuntu Picture 1

Or

Click the down arrow located in the upper right corner of the Ubuntu screen, click your username in the following view, and then click Account Settings from the drop-down menu.

How to assign admin rights to users in Ubuntu Picture 2How to assign admin rights to users in Ubuntu Picture 2

 

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

How to assign admin rights to users in Ubuntu Picture 3How to assign admin rights to users in Ubuntu Picture 3

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

How to assign admin rights to users in Ubuntu Picture 4How to assign admin rights to users in Ubuntu Picture 4

Enter the password and then click the Authentication button. You can now change any user's settings. Click the username of the user you want to set as admin.

How to assign admin rights to users in Ubuntu Picture 5How to assign admin rights to users in Ubuntu Picture 5

 

Under the user's Account Type, you'll see two buttons ; Standard button and Administrator button. Click the Administrator button to set this user to admin. As soon as you do this, the user will be granted admin rights and can now do all the operations that require root privileges.

Make user admin in Ubuntu via command line

The article will describe two ways to turn a standard Ubuntu user into an admin via the command line:

  1. Through the command usermod
  2. Via the gpasswd . command

We will use Ubuntu's command line application, Terminal, to do this. You can open Terminal via the system Dash or the keyboard shortcut Ctrl+Alt+T .

Method 1: Usermod . command

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

Syntax:

$ sudo usermod -aG sudo 'username'

This example will use the following command to set the user with the username 'sampleuser' as admin:

$ sudo usermod -aG sudo sampleuser

How to assign admin rights to users in Ubuntu Picture 6How to assign admin rights to users in Ubuntu Picture 6

Enter the password for sudo and the user will be added to the 'sudo' group which means that the person can perform all administrative tasks on Ubuntu.

You can verify that the user is currently in the 'sudo' group by checking the groups the user belongs to, via the following command:

$ groups 'username'

The following output of the groups command for "sampleuser" indicates that the user is now part of the sudo group.

How to assign admin rights to users in Ubuntu Picture 7How to assign admin rights to users in Ubuntu Picture 7

Method 2: Command gpasswd

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

Syntax:

$ sudo gpasswd -a 'username' sudo

This example is adding 'sampleuser' to the sudo group via the following command:

$ sudo gpasswd -a sampleuser sudo

How to assign admin rights to users in Ubuntu Picture 8How to assign admin rights to users in Ubuntu Picture 8

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

Syntax:

$ sudo gpasswd -d 'username' sudo

This example is removing 'sampleuser' from the sudo group via the following command:

$ sudo gpasswd -a sampleuser sudo

How to assign admin rights to users in Ubuntu Picture 9How to assign admin rights to users in Ubuntu Picture 9

Through the methods described in this article, you can turn a normal Ubuntu user into an admin so that they can perform all the tasks that require root privileges on the system.

4 ★ | 1 Vote