How to automatically load ssh keys when Windows 10 boots using putty pagent

As more and more people move to the cloud, they start to use ssh keys to authenticate to their cloud instances. This is great, as keys are generally considered more secure than passwords. But, with many new users to ssh, and putty in particular I am seeing a challenge with folks not loading in their keys when windows reboots, and then having issues logging into their cloud instances after a reboot.

Setting pagent up to automatically load keys is fairly straight forward under windows. First you will make a shortcut, that will use the command line to load the keys, and then place the shortcut into the startup folded in windows.

To create the initial shortcut, right click on your desktop and select new, and then shortcut.

image

Put in the path to pagent.exe, windows will help fill in as you type.

image

Once you have the pagent.exe, put double quotes around the full program name, and then a space and another double quote with the ppk file you want to load. You can have multiple ppk files

“C:\Program Files (x86)\PuTTY\pageant.exe” “c:\data\sshkeys\oci_private.ppk” “c:\data\sshkeys\demo_key.ppk”

image

Name the shortcut and save it. Now , you can simply run this to start pagent, and have your keys automatically load. But we can make this even easier by putting the shortcut into the startup folder.

Each Windows 10 user has their own startup folder, located in

C:\Users\$USERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Copy the shortcut to your personal startup folder, and you are done.

image

Hopefully this was able to make you day just a little bit better. Any questions, feel free to drop me a note in the comments.

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.