If you want to grant sudo-privileges to a user, there are two ways.
Add to Group
The simple one is to add the user to the corresponding group. This is easy but doesn't allow you to limit the sudo-privileges in any way.
The group for sudo is called differently depending on your distribution.
Debian and Ubuntu based distributions use the
RHEL based systems use the
# Debian [tux@server]$ usermod -aG sudo username # RHEL [tux@server]$ usermod -aG wheel username
Add to file
The more granular way is to specify the user in a configuration file in
/etc/sudoers.d/*. That way you can limit sudo to certain commands, if you want to.
You can call the configuration-file whatever you want, but I like to call mine like the username.
/etc/sudoers.d/username # Grant all privileges username ALL=(ALL) # Grant all privileges without asking for password again username ALL=(ALL) NOPASSWD:ALL # Grant only privileges for ls-command username ALL=(ALL) /usr/bin/ls # Grant only privileges for ls-command and do not ask for password username ALL=(ALL) /usr/bin/ls NOPASSWD:/usr/bin/ls