Walker News

Configure Putty To Support Password-less SSH Login

Putty is a great terminal emulator freeware written by Simon Tatham and team in C language.

This open source freeware was originally made as a Windows client for ssh, telnet, rlogin, and raw TCP computing protocols. Over the time, however, Putty has been ported to run on other operating systems, including the mobile Symbian OS that power my Nokia N73!
How to setup Putty for non-interactive, password-less SSH login

Similar to OpenSSH client setup, we could create a pair of public key and private key in Putty SSH client suite for the sake of password-less/non-interactive SSH login.

Assumption made for this example:

Putty client running in Windows Vista Ultimate needs a non-interactive, password-less ssh login to walker-b at Linux server WalkerNews-B. WalkerNews-B is running RHEL 4 Update 5 and installed with the bundled openssh-server-3.9p1-8.RHEL4.1 and openssh-clients-3.9p1-8.RHEL4.1.
  • Locate and run the Puttygen.exe (Putty Key Generator), select the SSH-2 DSA key type, press the Generate button and move the mouse over the blank area (as prompted) to generate some randomness on the keys:
    Using Puttygen.exe to generate SSH public key and private key for password-less ssh login.
     
  • When the key generation completed, copy all text of public-key in the box and append it to walker-b’s $HOME/.ssh/authorized_keys files.
    Copy the all text of public key in the box and append it to $HOME/.ssh/authorized_keys file.
     
  • Click Save Private Key button to save the Putty-generated private key that pair the public key appended to $HOME/.ssh/authorized_key file.
    Click Save Private Key button to save the Putty-generated private key.
     
  • Run the Putty client (putty.exe) to specify the saved private key and auto-login username before initiating connection to WalkerNews-B.
    Navigate to Auth option and specify the Puttygen-created private key for authentication before initiating connection to remote ssh server

    Specify the login user ID (i.e. walker-b):
    Specify the login ID in Putty for password-less ssh login

The Putty command line SSH clients support non-interactive, password-less ssh login too. This is useful if you need some Windows batch files or Windows scripts to automate file transfer between networked hosts via the SCP protocol.

For example, to transfer sourcefile to walker-b’s home directory at WalkerNews-B, execute PSCP.exe program (equivalent to OpenSSH scp command) in this way:
pscp -i id_dsa.ppk sourcefile walker-b@WalkerNews-B:

The -i option switch is used to specified a private key. In this case, it’s a Puttygen-generated private key that I’ve saved it as id_dsa.ppk.

If the Putty fails to work in password-less ssh login fashion, it automatically attempts to perform legacy login ID and password authentication. For troubleshooting, you can refer to Putty Event Log window, i.e. right-click the Putty window title bar and click on the Event Log menu:

Refer to Putty Event Log window to troubleshoot password-less SSH login related problem.

Custom Search

  1. How To Fix Telnet Rejection Error of Name or Service Not Known: Illegal Seek – Walker News 20-11-08@01:17

    […] need remote access facility. (Maybe telnet server will go into history when Windows start to bundle Putty or its own SSH […]

  2. Mike Shafer 27-12-08@00:51

    Hi,
    Thanks for the nice tutorial on configuring this. I use putty all the time to maintain servers at my business and client sites and it’s a pain to have to dig out passwords!

    One small point you might want to add is that when puttygen prompts for a password for the private key one needs to leave that blank and ignore the warning.

    Cheers!

    Mike Shafer

  3. Shri 23-10-09@21:19

    I did the same steps, but I am getting an error “Server unexpectedly closed network connection”. Earlier, I was using SSH-2 RSA type, but after reading your tut, I changed it to SSH-2 DSA. After this it got a little further: when connecting, it asked for the pass phrase, but after I entered the pass phrase, it gave the same popup error message again.
    Can you please help?

    Thanks in adv.

  4. yomismo 15-04-10@22:36

    Thanks a lot for this.
    I tried your other tutorial for How To Fix “Server Refused Our Key” Error That Caused By Putty Generated RSA Public Key?
    When I got it working I had forgotten my passphrase, so I re did everything and could not get it to work.

2014  •  Privacy Policy