Ubuntu - Giving Users Adminastrative Privileges

If you just want to allow a user to run commands with sudo, all you need to do is add them to the sudo group as shown below:

sudo adduser [USER] sudo  

The Sudoers File

Another way to add them, is to edit the /etc/sudoers file. One must use the visudo tool as shown below to prevent errors being made which could possibly "brick" your system.

sudo visudo -f /etc/sudoers  

Find the line below:

root    ALL=(ALL:ALL) ALL  

and then add your user directly below it.


Passwordless Sudo

If you want the user to be able to use sudo without having to enter a password, such as for automated installation scripts (not recommended), then you can edit the sudoers file as shown above, but enter the following line instead:




Stuart is a software developer with a passion for Linux and open source projects.

comments powered by Disqus
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites. More info.