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.

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

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.

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

 

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:

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

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

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

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.

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

 

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

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

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.

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

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

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

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

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

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.

Update 27 June 2023
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile