SSH: Password-less access (Putty)

Categories: Howto, Linux

In my previous post titled SSH: Password-less access (Linux) I detailed on how to do any secure.* (i.e., SSH, SCP, etc..) access between two Linux boxes. In other words, if your local box is Linux as well then the previous post would be a way to go for password less access. But what if your local box runs Windows? Well, here is a way to do the same.

Firstly, I assume you using putty for SSH-ing into the box for I am gonna detail how to do this for putty. Secondly, if you have not yet downloaded puttygen then do so before you proceed. Just like the previous post, we gonna have the same 3 steps with an additional step of configuring putty:

  1. Create public & private keys
  2. Copy public key to remote host
  3. Configure putty to use the private key
  4. Test

Create public & private keys

This is where puttygen is useful. Open puttygen and you should see this:

Open puttygen
Open puttygen

Click on ‘Generate.’ Once done, to create a unique seed for creating the key pair, do the following:

Random mouse movements
Random mouse movements

Now this should create a public key for you, as shown below:

Generated keys
Generated keys

Now, save the ‘Private Key’ somewhere, searchable in you system for later retrieval, and it has an extension ‘ppk’ (stands for putty private key!). In fact, this ppk file is very much human readable & you can retrieve your public key anytime as shown below:

PPK File
PPK File

That’s the end of first step! 🙂

Copy public key to remote host

Now to the next step. Copying the public created to the remote host. Now it is not mere copying but more like installing your public key over there. The simplest method is to append your public key into the ‘authorized_keys’ file (typically under ~/.ssh/). Choose your favorite editor and append the public key (as highlighted in the previous section) to the file. Finally your file should contain this:

authorized_keys
authorized_keys

Please notice that there is a ‘ssh-rsa’ token prefixed before the public key. This is very important. Don’t miss it.

Configure putty to use the private key

Now, the server is ready to receive your private key to authenticate you but we need to configure putty to send the private key. And, this how you do it.

Set the username for auto-login

My login name is ‘rp’ and so:

Auto login username
Auto login username
Set the private key
PPK path
PPK path

Save this session for future quick login! 🙂

Test

Open your saved session and see the magic unfold. 😉

Test Successful!
Test Successful!

So, there you go folks! Now we know how to login without password from Windows client as well! 🙂

«
»

    Leave a Reply

    Your email address will not be published.