When you first begin to access your fresh new server, there are a few early steps you should take to make it more secure.
Some of the first tasks required on a virtual private server can include setting up a new user,
providing them with the proper privileges, and configuring SSH.
1. SSH Root Login
It's not safe to login as root on your vps, and this tutorial will help you set up an alternative user to login with permanently.
Login with your ip adress and root password which has given you by your server's company.
now login to your server:
The terminal will show:
The authenticity of host '184.108.40.206 (220.127.116.11)' can't be established.
ECDSA key fingerprint is 37.57.57:1a:ab:37:11:8e:18.104.22.168:bb:3c:fa:c0.
Are you sure you want to continue connecting (yes/no)?
go and type Yes (Y), and then enter your root password.
2. Change your root password.
your current password is a default one that was sent to you when you registered your server.
The first thing to do is change it to one of your choice.
3. Creat a New User
# adduser demo
You will be asked a few questions, starting with the account password.
Enter a strong password and, optionally, fill in any of the additional information if you would like. This is not required and you can just hit ENTER in any field you wish to skip.
4. Root Privileges
Let’s go ahead and edit the sudo configuration. This can be done through the default editor, which in Ubuntu is called ‘nano’
Find the section called user privilege specification. It will look like this:
# User privilege specification
root ALL=(ALL:ALL) ALL
Under there, add the following line, granting all the permissions to your new user:
demo ALL=(ALL:ALL) ALL
Type ‘cntrl x’ to exit the file.
Press Y to save; press enter, and the file will save in the proper place.