Add Non Sudoer Account to the Sudoer User Group

Sunday, 29. July 2012

If you ever wanted to add a new non-sudoer account to sudoer group, here is the simple steps to help you achieve just that.

Log in to your server/machine as root.

Navigate and open the sudoers file

nano /etc/sudoers #Use your preferred editor
 
#OR AS RECOMMENDED:
 
sudo visudo #Better as it checks for syntax errors.

Once the file is opened, navigate to the bottom of the file until you find the line like this below..

## Allow root to run any commands anywhere
root    ALL=(ALL)	ALL
..

Underneath this last line, add the account details you want make sudoer

useraccount ALL=(ALL)	NOPASSWD:ALL

NOTE the “NOPASSWD”.
This simply allows the new account to use/call the sudo commands without having to type the password.

Save the file, and restart your terminal session again.

** NOTE
Some time you may have to delete the following entry in order to make things working.. do this if the first steps still gives you the same error.

Scroll right at the bottom and look for this line:

#includedir /etc/sudoers.d

Remove it! Restart session and you should be OK!

Enjoy!

Leave a Reply

You must be logged in to post a comment.