How to Create Sudo User on CentOS
Create Sudo User on CentOS
sudo is a Linux command which provides a mechanism for allowing administrator privileges to a normal user. In this tutorial, you are going to learn how to create
sudo user on CentOS.
Before you start to create
sudo user on CentOS. You must have the root user account credentials of your system.
Create a new
First Log in to the server as a root user.
ssh [email protected]_ip_address
Now to create a new user account we will use here,
adduser command. To add new user run below command replacing
NEW_USERNAME with the username you want to add.
After adding a new user you will need to set a password for it. to do so run following command in the terminal.
The output should look like:
Changing password for user username. New password: Retype new password: passwd: all authentication tokens updated successfully.
To add newly created user to
sudo group you should use
usermod -aG sudo NEW_USERNAME
How to use sudo
Now to use sudo command you should first switch to the newly created user:
su - NEW_USERNAME
Now you can run any command with
You can only use sudo account to display contents of
sudo ls -la /root
Now enter the password of the new user to get the list of files:
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:
After typing the correct password you will list root directory on your system.
You have successfully learned how to create sudo user on CentOS. If you have any queries regarding this then please don’t forget to comment below.
How to Install Laravel PHP Framework With Nginx on CentOS 8
How to install XAMPP on CentOS 7
How to Search and Replace Text in Vim or Vi
How to Install CMake on Debian 10
How to Install Pip on Linux Mint 19
How to Install Go on Ubuntu 18.04
How to Copy, Cut, Paste in Vim or Vi
How to Install Arduino IDE on Ubuntu 18.04
How to Install phpMyAdmin on Linux Mint 19
Linux Time Command with Examples
How to install LAMP stack on Ubuntu 18.04
How to Install Eclipse IDE on Debian 10