Quickstart Guide: Creating a Sudo-Enabled User on Rocky Linux 8

Introduction:

Creating a new user with sudo privileges is a fundamental step when setting up a Linux system. By granting sudo access to a user, you allow them to perform administrative tasks while maintaining security and accountability. In this quickstart guide, we will walk you through the process of creating a new sudo-enabled user on Rocky Linux 8.

Step 1: Accessing the Root Account:

To create a new user with sudo privileges, you need to have access to the root account or a user account with administrative privileges. If you don’t have root access, ensure you have administrative rights or consult your system administrator.

Step 2: Opening a Terminal:

Once you have the necessary access, open a terminal on your Rocky Linux 8 system. You can do this by searching for “Terminal” in the applications menu or by using the keyboard shortcut Ctrl+Alt+T.

Step 3: Creating a New User:

In the terminal, enter the following command to create a new user:

sudo adduser username

Replace “username” with your preferred username for the new user. Press Enter after typing the command. You will be prompted to enter a password and additional user information.

Step 4: Granting Sudo Privileges:

To grant sudo privileges to the new user, we need to add them to the sudoers file. In the terminal, run the following command:

sudo visudo

This command opens the sudoers file in the default text editor. Look for the line that says %wheel ALL=(ALL) NOPASSWD: ALL. Uncomment this line by removing the # character at the beginning. Save and exit the file.

Step 5: Testing Sudo Access:

To verify that the new user has sudo privileges, open a new terminal window and log in as the newly created user using the following command:

su - username

Replace “username” with the actual username you created. Enter the user’s password when prompted.

Once you have logged in as the new user, try running a command with sudo by prefixing it with sudo. For example:

sudo dnf update

Enter the user’s password when prompted and observe if the command executes successfully.

Conclusion:

Congratulations! You have successfully created a new sudo-enabled user on Rocky Linux 8. This user now has the necessary privileges to perform administrative tasks while maintaining system security. Remember to use sudo responsibly and only grant it to trusted users. Creating separate user accounts with limited privileges enhances the security of your Linux system.


Related Tags:

Leave a Reply

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