Add Sudo Privileges to User

Adding User to the sudo Group

usermod -aG sudo username

Adding User to the sudoers File

No password required

Limit 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

Add 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.

Last updated