Add Sudo Privileges to User
Adding User to the sudo Group
usermod -aG sudo usernameAdding User to the sudoers File
EDITOR=nano visudoNo password required
username ALL=(ALL) NOPASSWD:ALLLimit allowed commands
In the following example, username would only be allowed to use commands mkdir and rmdir without a password. All other commands would require a password for sudo
username ALL=(ALL) ALL
username ALL=(ALL) NOPASSWD:/bin/mkdir,/bin/rmdirAdd via seperate sudoers file
The /etc/sudoers.d/ directory allows the use of seperate drop in configuration files if you do not want to edit the main /etc/sudoers file itself.
echo "username ALL=(ALL) ALL" | sudo tee /etc/sudoers.d/usernameLast updated