Adding a user to the Sudoers list in Ubuntu 14.04

I run:


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

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

As a root perform:

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


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.

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>