How can I add a regular user to the sudoers file?

Just edit the file /etc/sudoers.

But you are supped to use /usr/sbin/visudo as your editor, since that will to some sanity checks before you exit.

So that would be:

sudo /usr/sbin/visudo

Here are some links that could be useful:

  • Sudo in a Nutshell
  • Sudoers Manual

My preferred method is to add them to the sudo group (admin before Ubuntu 10.04).

In Ubuntu Linux, the sudo group can run sudo and it is easy to add someone to that group:

usermod -a -G sudo username

Your mileage may vary with other distros, however, someone thought the group method made more sense than the sudoers file getting itself updatified. Less room for getting it wrong and locking everyone out of being superuser seems to be the reason.


Just edit your sudoers file

sudo visudo -f /etc/sudoers

and add the username like 'uk' without quotes

username ALL = (ALL)ALL

Save and exit would give the access.

Tags:

Linux

Ubuntu

Sudo