Search code examples
windows-servicessshplinkpageant

Plink from Windows service cannot find Pageant


I have one windows service which will use plink.exe for SSH connection and I found that Plink cannot find the running Pageant.

Here is the steps I have done so far.

  1. Install Windows service to run as particular user
  2. Before starting Windows service, I log in as that user and start Pageant with PuTTY generated key.
  3. Then I start the Windows service (but I can't manage to make it work since Plink cannot find Pageant and server reply as No supported authentication methods available.)

Note: If I run Windows service as console application with that user, everything is working fine.


Solution

  • As @Eugene point out, it is Session 0 Isolation.

    I managed to solve the issue by not using agent but directly passed the private key and password to plink.exe. By doing that, I'm able to run without using pageant.

    To start plink.exe without agent;

    plink.exe -noagent -i private_key.ppk -pw mypassword -P 1234 [email protected]