A vital skill in Linux administration is effective user management. A crucial task among the many others is making a new sudo-enabled user. Users with sudo rights can manage systems while retaining system security. We’ll walk you through creating a new sudo-capable user on Rocky Linux in this guide to help you strengthen system security and responsibility delegation. If you need vps hosting with configured hardware in America then our US server expert assistant will help you.
The sudo command offers a method for giving regular users access to administrator privileges, which are typically only available to the root account. This tutorial will demonstrate how to add a new user with sudo privileges to Rocky Linux 8 without having to change the /etc/sudoers file on your server. Adding a user to the sudoers list is essential for effective system management in Ubuntu, empowering users with the necessary administrative rights to execute critical tasks securely.
Steps to Create a New Sudo User on Rocky/Alma Linux
Besides that, You can start UK’s hightech trades with our forex VPS from London resulting in reduced lagging. Coming back to steps:
Step 1: Accessing Your Server In the First Step
SSH as the root user into your server:
$ ssh root@your_server_ip_address
Instead of the aforementioned your_server_ip_address, use the hostname or IP address of your server.
Step 2: With the below Command Add a New User to the System
To add a new user to your system, use the adduser command:
# adduser xyz
Make careful to swap out xyz for the username you want to use.
To change the password for the new user, use the passwd command:
# passwd xyz
Do not forget to substitute the newly created user for XYZ. Two times must be entered for the new password:
Step 3: Here in the Wheel Group Add the User in this Step
To include the user in the wheel group, issue the usermod command:
# usermod -aG wheel xyz
Again, be sure to swap out XYZ with the username you want to have sudo access to. On Rocky Linux, all members of the wheel group have complete sudo access by default.
Step 4: Testing sudo Access in the below Step
Use the su command to switch from the root user to the new user account before testing the new sudo permissions:
# su - xyz
If you want to run a task with superuser capabilities, put sudo before the command to make sure you can do so as the new user:
$ sudo command_to_run
You can list the items in the /root directory, for instance, which is typically only accessible by the root user:
$ sudo ls -la /root
You will be asked for that user’s account password the first time you use sudo in a session. To proceed, enter the password:
The command you used with sudo will run with root privileges if your user is in the correct group and you supplied the password correctly.
Conclusion
You’ve successfully introduced a new sudo-enabled user to your Rocky Linux system by following these simple instructions. By dividing up duties among dependable users, this procedure not only improves security but also simplifies administrative tasks. Apart from this, understanding the “sudo rm -rf” command is crucial for Linux users, as its misuse can lead to irreversible data loss and system failures, emphasizing the need for careful command execution and awareness of potential risks.
To preserve the integrity and stability of your Linux environment, always use caution when granting sudo rights and only give them to users who need them for specified tasks. To enable sudo access, you created a new user account in this quickstart instruction and assigned it to the wheel group.