- The Dyson Airwrap is $120 off ahead of Black Friday - finally
- This 5-in-1 charging station replaced several desk accessories for me (and it's 33% off for Black Friday))
- The best Galaxy Z Flip 6 cases of 2024
- This retractable USB-C charger is my new favorite travel accessory (and it's on sale for Black Friday)
- Skip the iPad: This tablet is redefining what a kids tablet can do, and it's 42% off for Black Friday
Linux 101: How to give users sudo privileges on Ubuntu and Red Hat-based Linux distributions
New Linux admins need to know how to give and take sudo privileges from users. Jack Wallen shows you how on both Ubuntu- and Red Hat-based Linux distributions.
Most users on your Linux machines might be non-admins who use services and directories for various purposes. However, you might come into a situation when you need to “promote” one of those users to admin and give them sudo privileges.
How do you do that?
Once upon a time, it was required that you edit the sudoers file–which is still very much possible, but not necessary. There’s a much easier and more reliable method of promoting those standard users with sudo privileges. I’m going to show you how to do just that.
I’ll demonstrate on both Ubunutu- and Red Hat-based distributions, specifically, Ubuntu Server and AlmaLinux. You’ll be surprised how easy this is. It’s all about adding those users to the right group. Let’s first do this on Ubuntu Server.
SEE: Linux file and directory management commands (TechRepublic Premium)
How to give users sudo privileges on Ubuntu Server
Log in to the machine and add the user in question to the sudo group with the command:
sudo usermod -aG sudo USER
Where user is the name of the user.
Once this is complete, the user will need to log out and log back in for the changes to take effect.
How to give users sudo privileges on Red Hat-based distributions
On Red Hat-based distributions the group is wheel, so the command would be:
sudo usermod -aG wheel USER
Where user is the name of the user to be added. Again, have the user log out and log back in so the changes will take effect.
How to remove users from a group
If you want to remove a user from those groups, the command would be:
sudo gpasswd -d USER GROUP
Where USER is the user name and GROUP is the group in question.
And that’s all there is to it. You’ve officially promoted those standard users with sudo privileges. Just make sure you only do this with users you trust, or you could wind up with serious problems to deal with.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.