Walker News

How To Create Putty-based RSA Public-key For OpenSSH Server?

If you want to remote access Linux server via SSH protocol from Windows system, I recommend you to use Putty (a Telnet/SSH freeware for Windows and UNIX; developed by an English man called Simon Tatham).

To strengthen security, don’t ever use plain text password, try to use RSA-based Public-key cryptography for user authentication. The Puttygen (Putty Key Generator; another freeware of Simon) can generate both RSA and DSA-based key pair.

However, the RSA public-key generated by Puttygen is not 100% compatible with OpenSSH server (the dominant SSH server in most Linux distributions).

To make it work, you need to modify the Putty-based RSA public-key before appending it to authorized_keys file.

Steps to generate Putty-based RSA key pair to login Linux OpenSSH server

1) Open Puttygen program and click Generate button to create a 1024-bit, SSH-2 RSA key pair. After clicking the Generate button, move the mouse cursor inside the Key frame repeatedly (Puttygen need these movements to create a “perfect random key pair”).

2) Once the key pair generation complete, think of a “strong” password and enter it twice in the Key Passphrase and Confirm Passphrase text boxes provided in Key frame.

3) Click Save Public-key and Save Private-key buttons to keep these two keys in local hard disk.

4) Transfer the public-key to your Linux home directory (assuming this public-key is made for yourself) and open it with vi editor (any text editor of your choice).

5) The original Putty-based RSA public-key is similar to this:

Original RSA type of public-key generated by Puttygen program.

You need to delete the lines started with “4 dash” and “Comment:” (i.e. first two and the last line).

Next, join all the remaining lines into one, single line.

Then, insert this ssh-rsa keyword (with a trailing space) in front of the single line.

The final, modified Putty-based RSA public-key will looks like this:

Modified, tweak RSA type of public-key generated by Putty client program, to be installed into OpenSSH authorized_keys file.

6) Now, append the modified Putty-based RSA public key to $HOME/.ssh/authorized_keys file and you’re ready to use Putty to access Linux OpenSSH server with private and public key generated by Puttygen.

Custom Search

  1. ankur 20-01-11@17:27


    you rock … steps worked perfectly .

    i was struggling with heroku deployment and finally managed
    to get it working on windoz..

    thanks man .

2014  •  Privacy Policy