How To Add A New Sudoer in Ubuntu

Linux is an operating system with a strict user permission. There are several level of users in Linux along with each privileges. Ubuntu, as a Linux based operating system, surely also has the same thing as other distros

In Ubuntu (and other Debian based distros), there is a group of users called sudoers. They are a group of users that have a “sudo” access. The “sudo” it self is a mechanism for granting administrator privileges. Users with a “sudo” privilege will be able to run some commands and access some files that require an administrator level

If you add a new user in Ubuntu, she/he will have no “sudo” privilege by default. But, you can give him/her the privilege if you want. There are two ways to add a new sudoer in Ubuntu

Method 1

The easiest way to add a new sudoer in Ubuntu is by run the following command.

$usermod -aG sudo username

Be sure you’ve logged as administrator before run the command. Type “sudo su” on your terminal to log in as administrator. The “#” symbol indicating you already have an administrator access

The command above will not affect until you reboot your computer. So, reboot your computer immediately once you run the command

Method 2

The other way to add a new sudoer in Ubuntu is by editing the sudoers file which is located at “/etc/sudoers”. But, this method is not suggested as it may can affect your system

  • Open your terminal and type “pico /etc/sudoers”. Add a user that you want and set the parameters like the example below. Press the “ctrl+o” once you done. Reboot your computer

pico

In order to see the list of sudoers in Ubuntu you can go to “etc/group” or type the following command for easier

$grep -Po '^sudo.+:\K.*$' /etc/group

Related posts

Written by Aliko Sunawang

A blogger who also interested in photography. A huge fan of Marvel's movies



Leave a Comment

Your email address will not be published. Required fields are marked *