How to Add User to Sudoers file

How to add user to sudoers file, list, or group so that you can give a new user root access or privilege. How do I add a user to Sudoers? How do I give a user Sudo permission? How do I edit Sudoers? How do I add a user to Sudoers Visudo? Believe it or not, these are fairly common questions and in all reality the answer is quite simple.

Adding a user on a fully installed Debian or Ubuntu Linux based system is possible by issuing the visudo command. Users in the sudoer group are allowed privileges to run commands and open files as root or administrator. The following segment covers the simple process of adding a new root user to an Ubuntu or Debian based systems.

Add User to Sudoers file using Visudo

Adding user to sudoers file or list to give root access and grant sudo privileges to users.

  1. Open a Terminal Ctrl + Alt +T
    Open a terminal to run visudo and add user to sudoers
  2. Type sudo su and then press enter.
  3. Next, type visudo and press enter (to access and edit the list).
  4. Using the up/down arrows, navigate to the bottom of the sudoers file that is now displayed in the terminal.
  5. Just under the line that looks like the following:
    root ALL=(ALL) ALL
  6. Add the following (replacing user with your actual users name):
    user ALL=(ALL) ALL
  7. Now press Ctrl+X and then press Y when prompted to save the file.

New Sudoer user added to group with root access

If all went well, your sudoers file should look similar to the one shown below. And the newly added user now has root privileges. So they can now also run sudo commands as root.

Add user to sudoers file

That is really all it takes to do this from a Debian or Ubuntu based operating environment. Keep in mind that you can repeat this process for as many users as you would like to add. Visudo might also come in handy for those times when you need to remove existing root users from the sudoers file. So you can use Visudo to delete and grant sudo privileges, on the fly.

This concludes the procedure to add user to sudoers file or group from within Debian or Ubuntu Linux. I’ll provide a follow-up at a later point in time, with a process for CentOS, Arch, and other Linux operating systems.