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 Node.js with npm on Linux Mint 19
- How to Install DataGrip on Linux Mint 19
- How to Install MySQL on Ubuntu 18.04
- How to Use grep Command in Linux with Examples
- How to Copy, Cut, Paste in Vim or Vi
- How to Stop and Disable FirewallD on CentOS 7
- How to Add Swap Space on Debian 9
- How to Install WordPress with LEMP Stack on Ubuntu 18.04
- How to Install PyCharm on Manjaro 18
- How to Install RubyMine on Manjaro 18
- How to Install Kodi on Manjaro 18
- How to install Node.js with npm on Debian 9