I need an SSH tunnel for my VNC to work. Currently I have a PuTTY connection that creates the tunnel, but which requires Pageant to authenticate. I also have Pageant, VNCc, and PuTTY in my Windows startup.

The annoyance for me is that PuTTY can't create the tunnel until after I put in my Pageant password. That means I can't just have PuTTY automatically connect to the session and sit in the background, I need to manually open a connection each time after I connect to Pageant.

Is there a way to better automate this, so the SSH tunnel 'just happens' at bootup without my having to do anything manually (other then my putting in my Pageant password, which I'm okay with doing for security)?

1 Answer 1


Pageant can execute a command after a private key is loaded, using -c switch.

So you can create a batch file like:

pageant.exe c:\path\to\mykey.ppk -c putty.exe -L 1234:localhost:1234 user@host

Though are you sure you need Pageant? Cannot you just specify your private key in PuTTY session settings?

  • I use my private key everywhere, so I'd rather only have to enter the password once through pagant. Still this works so thank you :)
    – dsollen
    Apr 10, 2019 at 15:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .