How to make a user an administrator in Ubuntu

s2 0

If you have more than one user on your Linux system, you may not want all of them performing administrative tasks or messing up private system settings. In this case, you can avoid giving these users administrative privileges on Ubuntu. Unauthorized users cannot install or uninstall software on your system or change important system settings and configurations. Even if you are not at your computer, no unauthorized user can perform these tasks, as Sudo rights are required for everyone and the Sudo password must be known.

However, if you want to give administrative privileges to a user, this article is here for your help.

In this article I describe how to make a user an administrator via the graphical user interface and which commands must be used in the command line to add a user to the sudo (authorized) user group.

We have the commands and procedures mentioned in this article on one Ubuntu 04/20 LTS system.

Make a user an administrator in Ubuntu through the GUI

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

Enter the ‘user‘Keyword in the System Dash and click on the search result “Users”.

or

Click the down arrow in the top right corner of your Ubuntu desktop, click your username in the view that follows, and then click Account Settings in the drop-down menu.

Account settings

The Settings utility opens and displays the Users tab. Please note that only an authorized user can change user settings in Ubuntu. First, you need to unlock the tab to make changes as an administrator by clicking the Unlock button in the top right corner of the users view:

User viewadvertising

This opens the following authentication dialog, in which you can enter the password for the authorized user:

Get sudo permissions

Enter the password and then click the Authenticate button. You can now change any user’s settings. Click the username of the user you want to make an administrator.

User details

In the user’s account type you will see two buttons; the Standard and Administrator buttons. click on the Administrator Button to make this user an administrator. As soon as you do this, the user is given administrator rights and can now perform all operations that require root rights.

Make a user an administrator in Ubuntu from the command line

We’re going to describe two ways to make a standard Ubuntu user an administrator from the command line:

  • Through the usermod command
  • Through the gpasswd command

We are using the Ubuntu command line application, the Terminal, to perform this process. You can open the terminal either from the System Dash or the keyboard shortcut Ctrl + Alt + T.

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 User mod -aG sudo “username”

Example:

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

$ sudo usermod -aG sudo sampleuser

Use the usermod command to give administrator privileges to an Ubuntu user

Enter the password for sudo and the user will be added to the group “sudo” 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 which groups a user belongs to with 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 add the “sampleuser” to the sudo group with the following command:

$ sudo gpasswd -a sampleuser sudo

Use the gpasswd command to create users and administrators

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

Syntax:

$ sudo gpasswd -d “username” sudo

Example:

In this example we remove the “sampleuser” from the sudo group with the following command:

$ sudo gpasswd -a sampleuser sudo

Remove user from sudo group

Using the methods outlined in this article, you can make a normal Ubuntu user an administrator so that they can perform all the tasks that require root privileges on the system.

How to make a user an administrator in Ubuntu