Generate SSH Key Pair on CentOS


SSH (Secure Shell) and SFTP (Secure FTP) support a very strong security model that can be used instead of the normal username and password authentication scheme.

Generate Your Keys

It is easy to generate your own ssh key using PuTTYgen software.You can download it from below link.

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

How to generate the key

Step 1:

Double click PuTTYgen, you will get a dialog with “Generate” button. Click the button “Generate”

Now it will ask you to move the mouse around to generate random keys (public key cryptography).

Step 2:

Once it’s complete, you are request to do the following,

 1. Enter the passphrase
 2. Press Save Public Key button to save the public key. For example, “john.pub”
 3. Press Save Private Key to save your private key. This save the private key in PuTTY’s own format ie., “.ppk” file. For example, “somename.ppk”

Step 3:

Next you have to save the public key to the server. This is done by simply copy the indicated text public key data from the puttygen dialogue windows and paste it into .ssh/authorized_keys file on the server home directory.

If the .ssh/authorized_keys file does not exist, please create it by yourself and change the permission to 600.

Please make sure the .ssh directory should be in 700 permission. While pasting the public key in authorized_key, don’t give any spaces.

 That’s it. Now open your putty and click SSH, select Auth in that choose your saved ppk file.