How To Ssh Server Using Private Key In Putty

How to ssh server using openssh software

Generating OpenSSH private and public keys pair.

To use public key authentication, the first step is to generate a pair of private and public keys on the Linux side. I would assume that you login as a user called "toylet".

1. Login Linux as user "toylet". You could do it at the Linux console or via telnet.
2. Execute 'ssh-keygen -t rsa' to generate a version 2 public and private key pair into directory /home/user/.ssh. The passphrase is optional (but preferred).

[email protected]:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/toylet/.ssh/id_rsa):
/home/toylet/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/toylet/.ssh/id_rsa.
Your public key has been saved in /home/toylet/.ssh/
The key fingerprint is:
ec:f4:3f:b5:fe:2f:de:22:6c:42:8c:38:ad:6c:5e:96 [email protected]

3. Execute 'cd /home/toylet/.ssh'.
4. You should see 2 files: id_rsa and Now execute the following command 'cp authorized_keys'.
5. Copy /home/toylet/.ssh/id_rsa from Linux to Windows.

Converting the OpenSSH private key to Putty format.

Next, we head to the Windows side. In step 4, you created two key files (id_rsa and Putty cannot directly open OpenSSH keys. We need to convert id_rsa to id_rsa.ppk using a program called puttygen.exe.

6. At the Windows side, download puttygen.exe from Putty website.
7. Execute puttygen.exe

8. Click File->Load Private Key, load the file "id_rsa" from Step 5. Enter the passphrase if you used it in step 2.

9. Now the key has been loaded as in the figure above. Hit the button "Save private key". The converted key would be saved as "id_rsa.ppk". Download putty.exe from Putty website. It's time to really login OpenSSH using putty.exe on Windows side. The steps here would be a little bit more complicated.

10. Invoke putty.exe.
10.1. Click "Session" in the sidebar.
10.1.1. Enter ip address of your server (e.g.,
10.1.2. Click "SSH" in the Protocol option.
10.2. Choose "SSH" under "Connection" in the sidebar.
10.2.1. In "Preferred SSH protocol version", select "2 only".
10.2.2. click "Auth" under "SSH". Hit the Browse button, select the file "id_rsa.ppk" from Step 9.
10.3. hit "Session" again in step 10.1.
10.3.1. Enter a name (e.g. "toylet.session") in the textbox directly under "Saved Sessions".
10.3.2. Hit the "Save" button. The name "toylet.session" would appear in the listbox of "Saved Sessions".
10.4. Double-click "toylet.session". Now you would be presented with a login screen for OpenSSH.
10.4.1. Enter the linux user name "toylet".
10.4.2. Enter the passphrase if you specified it in step 2.

Login as: toylet
Authenticating with public key "imported-openssh-key"
Passphrase for key "imported-openssh-key":
Last login: Wed May 31 12:35:00 2006 from
[email protected]:~$

11. You have successfully logged into your Linux server via OpenSSH.

Bobbin Zachariah 11:39 am

About Bobbin Zachariah

Founder of LinOxide, passionate lover of Linux and technology writer. Started his career in Linux / Opensource from 2000. Love traveling, blogging and listening music. Reach Bobbin Zachariah about me page and google plus page.

Author Archive Page

Have anything to say?

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

All comments are subject to moderation.