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.
[USER] ALL=(ALL:ALL) ALL
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 at the bottom of the file:
[USER] ALL=(ALL) NOPASSWD: ALL
First published: 16th August 2018