Connect To SSH Server Without Password Using Putty

Putty is one of top ssh client available on Windows. It is lightweight and just run out of the box. Doesn’t need installation and connect you to ssh server securely. But if you need to use automatic login or use your private rsa key to login to your ssh server you need an extra tips to do that.

Image Courtesy: Ryan Werber

Generate Public/Private Key

To generate public/private key in Putty you need to download a tools called puttygen from Putty download page. And follow the following instructions:

  1. Open puttygen.exe
  2. Select Key > Generate Key Pair Menu
  3. Follow the instruction to move your mouse into the blank area. See the image below:
  4. Save the public key as id_rsa.pub
  5. Save the private key as id_rsa.ppk
  6. That’s it.

Adding Public Key into .authorized_key

To enable automatic login to your ssh server, you need to upload your id_rsa.pub content into your ssh server under .ssh/.authorized_keys. Follow the following step by step instructions below:

  1. Connect to your server using putty normally
  2. If you are connected successfully and you will be in your home directory
  3. If no .ssh folder under your home folder (usually /home/), create one using:
    mkdir .ssh
  4. Create .authorized_keys with this command:
    touch .ssh/authorized_keys
    cd .ssh
  5. Open .authorized_keys with vim:
    vim authorized_keys
  6. Open id_rsa.pub in your local directory with notepad, and copy all the content.
  7. Paste it in authorized_keys file and save it.

Automatic Login Using pageant

After you generate public/private key using puttygen.exe, now you need to use pageant to automatically use your private key to login with Putty. Otherwise you need to add it manually under Connection > SSH > Auth in Putty for everytime you connect, wasting of time. The solution is use pageant and you add your private key.
See the following instructions:

  1. Download pageant.exe
  2. Run it, and it will be running in your taskbar
  3. Right Click it and choose “Add Key”
  4. Choose the id_rsa.ppk
  5. Now you can open new session and login without use your password anymore.

Now you need to add your id_rsa.pub key to all your ssh server to able to login without a password with putty. And remember to hide your id_rsa.ppk in your safest folder, because if somebody get this file, they can login to your server easily as well.

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.