I’m calling plink from C# code which is running as a certain Windows user. I call plink like
plink.exe user@hostname -pw password commands
Usually the plink process ends immediately after the commands have been run, but when the user which the code runs under is not logged into Windows, the plink process doesn’t end.
As all these zombie processes build up there comes a point when new processes can’t be created anymore…
Any idea why this would be happening?
This could be because the first time you connect to a new server PuTTY registers a host key in the registry, under the currently logged in user (under HKEY_CURRENT_USER). With that user not being logged in, that portion of the registry may be inaccessible.
Try moving the key to HKEY_LOCAL_SYSTEM. That process is described in detail here:
http://xxlinxx.wordpress.com/2009/03/23/set-up-an-ssh-tunnel-as-a-windows-service-using-putty-plink/
There is a final note on that page that could prove to be important too depending on your specific use case:
“Also, if the Windows SYSTEM user cannot see the host key for SSH connection, the tunnel cannot be established.”
PS: There is another page here here that talks about moving the cert to HKEY_USERS.DEFAULT