Using windows putty/WINSCP with public Key that has been generated by openssl

When you are trying to remote server or hosting web server, it is not that simple with your user id and password.

Those days are gone now and you will need to provide the public key to server and you will use private key that is matched with your public key.

The first step is you will need to create a public key pair from your  windows system first as below;

Open the windows command shell and type “ssh -keygen”

After that you might have to type for the passphrase which will be the password of your key.

Then you don’t have to put any file name it will still generate at the default folder which will be the “./ssh/id_rsa.pub”.

This will make more secure on your key which will block someone can steal from your system.

 

Now you have everything is ready to use putty or winscp from your windows system.

 

For you putty you can’t just use your pair key as a private key which will have following error if you use it without any conversion.

Unable to use key file "C:\publickey\id_rsa.ppk" (OpenSSH SSH-2 private key (old PEM format))
login as: Which you will need to use puttyGEn to convert your pair key(private key) to windows tool format as below; Convert this file into the right format to use with Putty:
  1. In Puttygen, in the ‘Conversions’ menu choose ‘Import’ and load id_rsa.ppk
  2. ‘Save private key’ to a different file
  3. Use this new file with Putty, either on the connection properties menu or run Pageant (the Putty key agent) and ‘Add key’ the new file. (You can e.g. create a shortcut to pageant in your Startup menu and give it the key file name as a command line parameter so this is loaded automatically for you.)
key conversions
key conversion

Then you can point above saved new private key from putty tool as below;

 

putty_selecting_private_key
putty_selecting_private_key

After above steps, it will be smooth to get the putty session without any issue.

 

 

For the WINSCP, it will need just minor tweaking as below;

winscp_advanced_set_for_private_key
winscp_advanced_set_for_private_key

Sure it should have same conversion step as above after generate the key from openssl.

 

Leave a Reply