It’s much easier to set up PuTTY to login without password to a remote machine.

You will need to provide a key to the remote server that will authenticate you without password when things are set.

Generating the key

You can use Puttygen to generate the key if you don’t already have one. Once you made your preferences around the encryption setup (if you don’t want to bother with it, it’s quite safe to leave it on default settings, it will generate a 2048bit RSA key), click on Generate and the process will start. The software will ask you to make some random movements with the mouse pointer, and after a while the key will be ready.

Note:

At this point you will have to decide if you plan your key ever to be stolen. Seriously, the inconvinience is when you install it on a laptop and someone else get it’s hands on it, be aware that the mentioned 3rd party will have password-less access to all your servers that you installed your login key on. For that case, you can enter a Key passphrase in case the key/laptop is stolen, but then again it will ask you the passphrase instead of the password every time you try to logon to your remote machine. So just forget it, but be aware of this issue, and if you find it necessary, protect the login to your mobile device and encrypt your private data to try to prevent unathorized access.

Now you can save the public and the ptivate keys on a safe place on your convinience.

Installing the key to a remote server

Since there’s no ssh-copy-id in Windows (as far as I can tell), we’ll have to do this manyally.
So, when you created the key, the public key appeared in the upper textbox in PuttyGen, with a title “Public key for pasting into OpenSSH authorized_keys file:” – this is exaclty what we have to do. Select All (all!) in that winndow and copy it. Then login to the remote machine on PuTTY with your password and if it’s a CentOS (my favorite), then

vi ~/.ssh/authorized_keys

Paste the key there (in a new row), and save.

Setting up PuTTY to work with the key

Just load your saved session if there is one, or create a new one – enter the IP/URL and port of the server and give the session a name.

Then on the left panel, go to the Connection -> Data option in the tree, and on the right side enter the username that you will use to login to the remote machine (I guess it’s root) in the Auto-login username field. Furthermore go down in the left pannel the Connection -> SSH -> Auth branch on the tree, click Browse on the right side, and point to the private key that you saved (the file with the .ppk extension).

Now the last thing – in the left panel, click on the Session option of the tree, and click on the Save button on the right panel (this is the part I usually forget, and lose all the settings after clicking on Open).

Leave a Reply

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

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