Wednesday, April 8, 2015

Manual SSH Key

One of the methods logged in VPS it is quite safe to use SSH Key to replace the password.
By default, each VPS you will log in with the username root and the root password that vendors have sent you hire VPS time, however, the use of passwords has always had two major risk is:


You will be completely lost if the recipe password.
The attacker can use Brute Force Attack to detect password.
Therefore, I encourage you to become familiar with SSH Key to login to VPS, and use it to authenticate the connection from the outside for safer.
How it works SSH Key

SSH Key you just know is simply a method of user authentication access by comparison between a private key (Private Key) and public key (Public Key).

Public key and private key is always in close contact with each other so that it can recognize each other. So I said to you easy to imagine then, when creating an SSH Key, you will have the two types of this key. Then you bring the public key of the server you give up, and the private key will be stored on your computer and log into the server, you will be sent login request with the Private Key to send a signal to the server, the server will check your Private key matches the public key on the server or not, if so, you will be logged.

The content between the Private Key and Public Key totally different, but it still will identify with each other through an algorithm of its own.

Envisioned Private Key is the key, and Public Key locks. Once the key that fits the lock, the door will be open, that's all.

The main components of an SSH Key

When creating an SSH Key, you need to know will have three important components as follows:

Public Key (file and string) - You will copy this key character will remove the file ~ / .ssh / authorized_keys on your server.
Private Key (file and string) - You will save this file to your computer, then set the PuTTY, WinSCP, MobaXterm, .. to be able to login.
Keypharse (string format, to remember) - to open private key password when logging into the server it will ask this.
And an SSH Key you can use for many different server.

I. How to create SSH Key

1.1) for Windows

If you use Windows, the software will use PuTTY to SSH-Gen, you can download PuTTY-Gen here.

Upload your finished opens, select the options as shown in the image below and press Generate.
As the public key is cumbersome above the range, it begins with ssh-rsa keyword-XXXXXX. This will copy the paragraph that you will give to the server. You can stay in one text file for later or do not need to be taken if the public key, you simply press the Load button in the software PuTTYGen private key file and then open it to the public key itself out.

For Linux (Mac / Ubuntu / LinuxMint, ..)

If you are using Linux does not need software that will use the Terminal to create. Open up Terminal and type:

01
ssh-keygen -t rsa
It will ask if you want to save the private key to where it will be saved to the default /home/user/.ssh. You can leave and enter.

Continue it will ask you if you want to set keypharse not, if desired, enter keypharse to set in and Enter.
Disable user password

After the test, if you were able to log into the server using SSH Key can disable user password because if not shut down, the attacker still brute force attack as often and you still lose data if Highway password.

To disable the use of a password, you open the file / etc / ssh / sshd_config, and find and edit the values ​​of the parameters as below:

01
PasswordAuthentication no
01
USEPAM no
Epilogue

Through this article you may have understood the SSH Key is and how to use it, this is one very important thing you need to do because we can not log on to VPS sales through traditional methods password, it is very dangerous if your computer has malware or accidentally reveal password. So my advice is to practice this makes the familiar and use on your VPS.

No comments:

Post a Comment