The other day I had to add a sudo user in Linux. I have done this many times in Ubuntu/Debian Linux boxes, but forgot how to create a new Linux superuser in RedHat/CentOS/Fedora family.
I created this quick review and maybe can help others.
Create New Linux Superuser in Ubuntu/Debian
Let’s do this using the Terminal/Command-line way. Open your terminal and type:
sudo adduser newuser
The newuser is the name of the new user you’re trying to create.
The above command will create the new user. Now, you need to add the newuser to the sudo group. Type the next command in your terminal:
sudo usermod -aG sudo newuser
Little explaination about the above -a means to Append and G stands for Group.
When you’re done adding the user to the sudo group, you should verify by running this command in your terminal:
You should see the sudo group listed.
You can also do the first two commands in one shot:
sudo adduser newuser sudo
Linux is cool! Brew coffee at home is ever better! 🙂
Create New Linux Superuser in RedHat/CentOS
Using RedHat 8 at one of my clients. I haven’t touch this Linux disto in a while, but its no big deal. I took a walk by Pier 76 in NYC before handling this one.
Create a new user you need the adduser command:
Next, set a password for the newuser:
Last, you need to add the newuser to the wheel group:
usermod -aG wheel username
Now, if you haven’t open the sudoers file using this command:
Edit the line %wheel ALL(ALL) by removing the ‘#’ character in front of it. There might be other options for the wheel group let say you can add or un-comment this line:
%wheel ALL=(ALL) NOPASSWD: ALL
This will allow the users in the wheel group to run sudo without having to enter their password every time.
Hope you like this brief tutorial. You can always contact me if you have any questions. Also, check out my T-Shirts and coffee mugs shop. I made all the designs.