Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Make Pageant autoload keys at startup
To make Pageant automatically run and load keys at startup:
- Find the location of pageant.exe
- Windows key + R to open the 'run' dialog box
- Type: 'shell:startup' in the dialog box
- Create a shortcut to the pageant.exe and put into this startup folder.
- Right click on the shortcut and open 'Properties'
- In 'Target' add: "<route to>/pageant.exe" myprivatekeyname.ppk
- In 'Start in' add: "<route to myprivatekeyname.ppk>"
- Click on the shortcut link and check that Pageant has started and has loaded your keys
@robertbjarum
Copy link

robertbjarum commented Sep 12, 2018

Thanks! Can you handle keys that are password protected?

@r3wt
Copy link

r3wt commented Sep 24, 2018

@robertbjarum i don't think so. try it and see. it may just prompt you to enter the password when you try to connect. been so long since i used such a key i can't even remember how putty handles it.

@Wolfium
Copy link

Wolfium commented Mar 25, 2019

@robertbjarum i don't think so. try it and see. it may just prompt you to enter the password when you try to connect. been so long since i used such a key i can't even remember how putty handles it.

You were correct, at shortcut launch if private key is passphrase protected it will be prompted,
Which is really slick to do only one time passphrase entering at login time and no more.

Thanks for the tips

@arzhh
Copy link

arzhh commented Nov 18, 2019

Thanks ! Also, you can add multiple keys with
"<route to>/pageant.exe" myprivatekeyname.ppk myprivatekeyname_2.ppk myprivatekeyname_3.ppk

@j-carpentier
Copy link

j-carpentier commented Dec 15, 2019

thanks a lot for this tips !

@aktentasche
Copy link

aktentasche commented Jan 7, 2020

awesome thanks

@krishna2k5
Copy link

krishna2k5 commented Feb 17, 2020

Hi, I am Krishna trying to follow what's explained above. In that I have doubts. One is that, is the path where the Putty resides? Also, this one is where the PPK is available or how does that be. Could you provide examples for that?

  1. In 'Target' add: "/pageant.exe" myprivatekeyname.ppk - Eg. required.
  2. In 'Start in' add: "" - Eg. required.

@aktentasche
Copy link

aktentasche commented Feb 17, 2020

example for 1:
"C:\Program Files\TortoiseGit\bin\pageant.exe" myprivatekeyname.ppk

example for 2:
C:\Users\foo\Documents

@ThomDietrich
Copy link

ThomDietrich commented Mar 4, 2020

Why so complicated? Just create a shortcut to your ppk file (assuming ppk is linked to pageant; that's default using the putty installer)

@ewidance
Copy link

ewidance commented Mar 17, 2020

Shorcut only works with an single ppk key. It you make more than 1 shortcut, there will be more than 1 instance of pageant, and putty does not seems to know how to deal with. It that case, editing a shortcut to pageant to add complete pathes of multiple keys seems to be the best solution:
"C:\Program Files\PuTTY\pageant.exe" "C:\my complete path to private key1.ppk" "C:\my complete path to private key2.ppk" ... "C:\my complete path to private keyX.ppk"

Password will be prompted for each key requiring it.

@ThomDietrich
Copy link

ThomDietrich commented Mar 17, 2020

Makes sense.
On a wider scope I wonder - on a personal and case by case basis - if multiple keys are meaningful. Ideally one has one key per device and when the device is lost/compromised the key is removed from the list.

That said, of course it might make sense to have multiple keys per "trust level" (private, work, work-critical-infrastructure) - yet again that does not make sense when all of them are automatically loaded during startup :)

@teliot
Copy link

teliot commented Aug 16, 2020

I have key files associated with pageant, this allows me to put the keys in startup directly.

@dan-s-el
Copy link

dan-s-el commented Aug 20, 2020

Thanks!

@arnoldnipper
Copy link

arnoldnipper commented Mar 2, 2021

Works like a charm. If you have multiple keys add a path in "Run in" to the directory where the keys are

@xkolk
Copy link

xkolk commented Mar 21, 2021

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
"Pageant"="cmd /c \"for %i in (\"%USERPROFILE%\\*.ppk\") do start \"%ProgramFiles%\\PuTTY\\pageant.exe\" \"%i\"\""

@zdevel
Copy link

zdevel commented Sep 23, 2021

Would it be possible to link to some kind of file (maybe a .bat file or something) that containts a list of the keys to load?

@PHPGangsta
Copy link

PHPGangsta commented Nov 11, 2021

Since version 0.75 pageant supports loading a key still encrypted, and decrypting it later by prompting for the passphrase on first use.

In the command line, load it with "--encrypted <path_to_key>"

See documentation:
https://the.earth.li/~sgtatham/putty/0.76/htmldoc/Chapter9.html#pageant-deferred-decryption

@xsoft
Copy link

xsoft commented Nov 29, 2021

Please update HELP to Pagent as well. Since there is no mention of this parameter or/and option.
This (git page) is the first place when I found an answer to this feature mentioned at changelog

help:

9.3.1 Making Pageant automatically load keys on startup
If the keys are stored encrypted, Pageant will request the passphrases on startup. 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment