The “sudo” command allows users to run any other commands, services, or program with the privileges of another user, and by default, it took the privileges of the root user.
In this document, we will learn how to create a new user with sudo access on Red Hat Operating System. So, you can use this user to execute an administrative command in the system without login as root user in your RHEL machine.
You can read full article here - https://linuxconcept.com/how-to-create-a-sudo-user-on-rhel-red-hat-enterprise-linux-operating-system/
1. CREATE A
SUDO USER
ON RHEL
Red Hat Enterprise
Linux Operating System
Prepared by: Satish Kumar
Founder, LinuxConcept
LINUXCONCEPT
LINUXCONCEPT
LINUXCONCEPT
https://linuxconcept.com/how-to-create-a-sudo-user-on-rhel-red-hat-enterprise-linux-operating-system/
2. LINUXCONCEPT
We talk about “sudo” privileges, we are talking about
the “sudo” command.
The “sudo” command allows users to run any other
commands, services, or program with the privileges of
another user, and by default, it took the privileges of
the root user.
In this tutorial, we will learn how to create a new user
with sudo access on Red Hat Operating System. So, you
can use this user to execute an administrative command
in the system without login as root user in your RHEL
machine.
https://linuxconcept.com/how-to-create-a-sudo-user-on-rhel-red-hat-enterprise-linux-operating-system/
3. LINUXCONCEPT
CREATE A SUDO USER
We will create a new user in RHEL machine with sudo
privileges in simple four steps. If you want to give sudo
privileges to an existing user, just need to add in “wheel”
group and for that directly go to step 4.
Step 1: Log in to your server
In the first step, you need to login into your system or server
with root user, using the SSH command:
$ ssh root@server_ip_address
Step 2: Create a new user account
Now, we will create a new user in this RHEL machine by using
‘adduser” command. Please replace the “user_name” with the
user name that you want to create:
$ adduser user_name
https://linuxconcept.com/how-to-create-a-sudo-user-on-rhel-red-hat-enterprise-linux-operating-system/
4. LINUXCONCEPT
Step 3: Set password for Username
You should run the “passwd” command to secure user with
password, as show below:
$ passwd user_name
You will get the new screen to set new password for given
username, like below:
Changing password for user user_name.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
Step 4: Add new user to sudo group
In the RHEL system if you get a member of the wheel group
you will get the sudo access. To add a user into the “wheel”
group, use the following usermod command:
$ usermod -aG wheel username
https://linuxconcept.com/how-to-create-a-sudo-user-on-rhel-red-hat-enterprise-linux-operating-system/
5. LINUXCONCEPT
TEST THE SUDO ACCESS
To check you have sudo access or not, first go to your account
login. To this either you login using your username and
password or switch to your account using “su” command, as
shown below:
$ su - username
Now, run “whoami” command with sudo:
$ sudo whoami
If the user having sudo access, you will get the output of the
“whoami” command is “root”:
Output-
root
https://linuxconcept.com/how-to-create-a-sudo-user-on-rhel-red-hat-enterprise-linux-operating-system/
6. LINUXCONCEPT
HOW TO USE SUDO
To use the sudo privileges with any command is very simple,
prefix the command with “sudo” and space as shown below:
$ sudo ls -l /root
In a session, first-time use of “sudo”, you will get a screen to
enter the user password:
Output-
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 username:
Conclusion
You have learned how to create a new user in Red Hat System
and assign the sudo access or privileges to a user in RHEL
machine. Now, you can log in into your Red Hat system or
server with your user access and use “sudo” command to run
administrative commands.
https://linuxconcept.com/how-to-create-a-sudo-user-on-rhel-red-hat-enterprise-linux-operating-system/
7. LINUXCONCEPT
THANK YOU
You can check our website https://linuxconcept.com for
more similar information on Linux or opensource
technologies.
https://linuxconcept.com/how-to-create-a-sudo-user-on-rhel-red-hat-enterprise-linux-operating-system/