Atlantic.Net Blog

How to Create a Sudo User in Rocky Linux 8

Hitesh Jethva
by Atlantic.Net (395 posts) under Tutorials, VPS Hosting
0 Comments

In Linux or Unix-based operating system, there are two types of users: a superuser (root) and a normal or regular user. The root user has full control of the operating system and it has privileges to run administrative commands like installing, removing, and updating software packages, changing permissions, and configuring different services. The non-root users have limited interactions with an operating system environment and they can perform only user-specific tasks.

The sudo command, short for “super-user do,” is a Linux utility that allows a normal user to run any commands with unlimited privileges. In this case, you will need to add a normal user to the sudo group in order to execute administrative commands.

In this post, we will show you how to create a sudo user in Rocky Linux 8.

Prerequisites

  • A server running Rocky Linux 8 on the Atlantic.Net Cloud Platform
  • A root password configured on your server

Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Rocky Linux 8 as an operating system with at least 1GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Create a Normal User in Rocky Linux

If you have not created any normal or no-root user on your system, then you will need to create one user.

Let’s create a new user named user1 with the following command:

adduser user1

Next, set a password for this user with the following command:

passwd user1

You will be asked to set a password as shown below:

Changing password for user user1.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.

Enable Wheel Group access for All Users

Next, you will need to edit /etc/sudoers file and confirm that the wheel group is enabled.

nano /etc/sudoers

Make sure the following line exists:

%wheel ALL=(ALL) ALL

Save and close the file after the confirmation.

Add a Normal User to the sudo (wheel) Group

Next, you will need to add your created user to the sudo (wheel) group in order to grant it administrative privileges.

You can use the usermod command to add a normal user to the wheel group.

usermod -aG wheel user1

This command will add a user1 to the wheel group.

Verify the Sudo User

After adding a normal user to the sudo group, you will need to verify whether the newly created user has sudo rights.

To verify, switch the user to the user1 using the following command:

su - user1

Next, run any administrative command with sudo:

sudo dnf update

If everything is fine, you will be asked to provide a password for user1:

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for user1: 

Provide the password of user1 to run the above command.

The above output confirms that the user has sudo rights and can run administrative commands.

Conclusion

In this post, we explained how to create a sudo user in Rocky Linux 8. You can now grant superuser privileges to any regular user in your Linux environment. Try it on VPS hosting from Atlantic.Net!

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

How to Install Apache Solr on Oracle Linux 8
How to Install Apache Cassandra on Oracle Linux 8
How to Install Yarn NPM Package Manager on Oracle Linux 8
How to Install Apache Spark on Oracle Linux 8
How to Install Docker and Docker Compose on Oracle Linux 8

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2008 Lookout Dr,

Dallas, Texas 75044

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources