How Do You Add a Linux User to the sudoers Users?

Problem scenario
You want a given Linux user to be added to the sudoers group.  You want the user to be able to use the "sudo " command before running other commands.  How do you give the sudo privilege to a given user?

Solution
If you are using Debian or Ubuntu Linux, do this (but replace "cooluser" with the username of your choice):
sudo adduser cooluser sudo

If you are using CentOS/RHEL/Fedora, do this (but replace "cooluser" with the username of your choice):

Modify the /etc/sudoers file.
Find this stanza:
root    ALL=(ALL)    ALL

Add a stanza above it like this:

cooluser ALL=(ALL)    ALL

Leave a comment

Your email address will not be published. Required fields are marked *