Report this

What is the reason for this report?

Adding a user to the Sudoers list in Ubuntu 14.04

Posted on May 17, 2014

I run:

visudo

and I’m presented with a blank file. I read a Digital Ocean article on this and apparently there is supposed to be something in here that I can replicate for my main user account.

While I am not completely new to running a Linux system, I haven’t done it in awhile & I certainly have never used a VPS before where I need to configure this.

Figured I would ask here first before I totally just bomb my box and have to start over :p



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Try to re-install the package sudo. If this don’t work try enter these in the file manually <br><pre># <br># This file MUST be edited with the ‘visudo’ command as root. <br># <br># Please consider adding local content in /etc/sudoers.d/ instead of <br># directly modifying this file. <br># <br># See the man page for details on how to write a sudoers file. <br># <br>Defaults env_reset <br>Defaults mail_badpass <br>Defaults secure_path=“/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin” <br> <br># Host alias specification <br> <br># User alias specification <br> <br># Cmnd alias specification <br> <br># User privilege specification <br>root ALL=(ALL:ALL) ALL <br> <br># Allow members of group sudo to execute any command <br>%sudo ALL=(ALL:ALL) ALL <br> <br># See sudoers(5) for more information on “#include” directives: <br> <br>#includedir /etc/sudoers.d</pre>

If you’re already running as root, check to see if the sudoers file exists by typing in: <br> <br>ls /etc/sudoers <br> <br>That will kick the file listing out if the file exists. If you have the file available, go with: <br> <br># vi /etc/sudoers <br> <br>You should be able to get to ‘insert’ mode by pressing ‘i’ and you will see a notice about it being a read-only file (disregard that since you will be root), enter in the new user, hit escape, and force the file to save by entering in ‘:wq!’ <br> <br>Hope that helps.

As a root perform:

Step 1: adduser demo Step 2: gpasswd -a demo sudo Step 3: passwd demo

Reference: https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.