Close

November 5, 2017

How to connect to VPS for the first time and how to secure it? – Quick Startup Guide

How to connect to VPS

After you purchase a KVM VPS you will soon receive an e-mail with your login credentials. The E-Mail would contain the root password and the IP of the VPS. Once you have received info you are ready to go. Now must know How to connect to VPS, the following steps depends weather you are a Windows user or a Linux user.

how to connect to vps

Logging to your VPS through Windows

First you have to install a SSH client – SSH is shorten for secure shell which is a protocol that allow computer admins as yourself to access a remote computer securely-. There are many SSH client software for Windows for example bitvise, putty , ….etc. The default port for SSH is 22 and that is the port of a new VPS. We will change that later but for know put the IP address, the user (root), the password and the port number (22).

Once you press login a connection with the VPS will be established and you can now manage your VPS.

how to connect to vps with bitvise

Logging to your VPS through Linux

Through Linux distributions logging to your VPS would be more simple you don’t have to install any software. All you have to do is to type the following command.

ssh IP_address -l root -p 22

You would be prompted with a message type yes then enter the password and press enter.

how to connect to vps through linux

How to secure your VPS Machine

Now you can establish your first VPS connection with method suites you as above. It is highly recommended that you take some security measures. Here we would suggest simple but very effective security precautions.

Changing the default Root Password

The first securing step that you’re advised to change default root password that generated by our system to do that just login to your VPS and type the following command.

passwd root

You’ll be asked to enter a new UNIX password and repeat it one more time before it is set. Choose a strong password consists of upper case and lower case letters as well as symbols and numbers.

how to connect to vps change password

Changing the default SSH port

One of the simplest most effective ways to secure your VPS is to change the default port.

Login to your VPS machine and use you favourite text editor to edit the file sshd_config

nano /etc/ssh/sshd_config

how to connect to vps copy id

Change the port number in the following image to any number you desire but make sure the port is not used by another service. You can view open ports

netstat --numeric-ports

how to connect to vps change port

 Set up  SSH keys

To enable login to the VPS without the use of the root password. We have to  create SSH key pair. The SSH key pair consists of a public and a private key. The private key is on your local machine while the public key is on the remote server. Once both keys are matched you can login to your VPS without the need of the root password.

1-Generate the SSH key pair

ssh-keygen -t  rsa

You will be prompted by a message to specify a place to store your key and another one if you want to add a passphrase. You can skip both.

how to connect to vps keygen

2-Upload the public key to the remote VPS

ssh-copy-id [email protected]_address

You will be prompted to enter the root password of the VPS. Enter the password and the public key will be uploaded. You can now login without your password. You can also disable password login for root /etc/ssh/sshd_config

3-Restart the ssh service

reload ssh

Conclusion:

Now you learned How to connect to VPS and how to secure it, this is just the first basic steps to manage your VPS. you must add more secure items as your machine require, whatever software you’ll run to fit your web application you almost need security in each component you will use, we will try add more security options in each upcoming tutorial for all user’s level , keep around and add comments we will reply soon.

Leave a Reply

Your email address will not be published. Required fields are marked *