More often than not, you are not the only one working on your server, sometime it may be a team, or a partner that needs to login to your server, or just someone you hired to help you out, its always better to create another user login for that person, its not mandatory, but is always useful, the guide below will help you to create a new user, and also set up the restrictions on that account as you see fit.
So, click on the video down below to follow along, or go to the steps right below it.
Step 1 – Create new user.
This new user will be used for you to login to your server. Use command below to create new username:
1 | /usr/sbin/adduser newuser |
Note: *change “newuser” above with your own new username. In this example I use my name “shreyash”.
Then issue this command to setup password for that user:
1 | passwd newuser |
Upon hitting Enter on your keyboard your server will ask you to type the password for that user.
Step 2 – Setup root privileges to that user
In this example I will create a clone of the root user, that is, another user who can work as a root user.
To do that simply issue this command:
1 | vi /usr/sbin/visudo |
then look for the line / section called:
1 2 |
# User privilege specification root ALL=(ALL) ALL |
or in different CentOS release it may also like this:
1 2 |
## Allow root to run any commands anywhere root ALL=(ALL) ALL |
Then add this line right after the root line:
How to edit? Press “i”, to go into insert mode, then make the appropriate changes, press “Esc” to get out of insert mode, then write “:wq” and hit enter to write the changes and exit.
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
newuser ALL=(ALL) ALL
it should look like this:
0 Comments