How to add user to sudoers list, file, or group so that you can give a new user root access or privilege. Believe it or not, this is a fairly common question and in all reality the answer is quite simple. Adding a user to the sudoers file on a fully installed Linux system such as Ubuntu or Debian is possible via the visudo command. Users in the sudoers 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 Ubuntu.
Adding a New User to Sudoers list
Add user to sudoers list to give a new user root access and sudo privileges.
- Open a Terminal Ctrl + Alt +T
- Type sudo su and then press enter.
- Next, type visudo and press enter (to access and edit the list).
- Using the up/down arrows, navigate to the bottom of the sudoers file that is now displayed in the terminal.
- Just under the line that looks like the following:
root ALL=(ALL) ALL
- Add the following (replacing user with your actual username):
user ALL=(ALL) ALL
- 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 can now also run those sudo commands as root.
That’s really all there is to granting root access to a new user or to add user to sudoers list. 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.