Initial Server Setup with CentOS

Some of the steps to make a server more secure, when you first access your virtual private server. Some of them are setting up a new user, providing them with the proper privileges, and configuring SSH.

It is not encouraged to use root on a regular basis, and you should set up an alternative user to login with permanently.

Create a New User

Use the following command to create a new user (e.g. demo).

adduser demo

Create a new password for the user ‘demo’:

passwd demo

Giving Root Privileges

Edit the sudo configuration


Look for the line:


Under the details of root’s privileges, add the following line, granting all the permissions to your new user.

To begin typing in vi, press “i”.

demo ALL=(ALL) ALL

Then press Esc, :, w, q and the Enter to save and exit the file.

Note: When you perform any root tasks with the new user, you will need to use the phrase “sudo” before the command. This command is very helpful as: 1) it prevents the user from making any system-destroying mistakes 2) it stores all the commands run with ‘sudo’ to the file ‘/var/log/secure’ which can be reviewed later, if needed.

Have something to Add?

Loading Facebook Comments ...
Loading Disqus Comments ...