This blog will let you know how to create sudo users on CentOS.
Steps to create new sudo user
Step One: Login to your server as root
user
$ ssh root@server_ip_address
Step Two: Use the adduser
command to add new user to your system
adduser username
Use the passwd
command to update user's password
passwd username
Prompt will appear now and it will ask to confirm password
Set password prompts:
Changing password for user username.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
Step Three: Add user to the wheel group by usermod
command
usermod -aG wheel username
Step Four: Test sudo access on new user account
i) Switch user by typing su
command
$ su - username
$ sudo command_to_run
example:
sudo ls -la /root
OUTPUT:
[sudo] password for username:
If your user is in the proper group and you entered the password correctly, the command that you issued with sudo should run with root privileges.
Thanks for reading the blog
0 Comment(s)