问题
the problem in a nutshell: running plink(with specific arguments) works from cmd, but not from asp.net
the command being executed: "C:\Program Files (x86)\PuTTY\plink.exe" -batch abc@xyz ./fake_email.sh
from cmd, the command executes correctly, with fake_email.sh returning "0". from asp.net i get the following error: The server's host key is not cached in the registry. You have no guarantee that the server is the computer you think it is. The server's rsa2 key fingerprint is: ssh-rsa 2048 sequence Connection abandoned.
i think it has something to do with the user(which .net uses to start a process) not being able to "see" the key which pageant is making available. i am running cmd as administrator.
i am happy to post more info.
can anyone point me in the right direction?
thanks for your help.
回答1:
solved it.
asp.net by default executes processes as "NetworkService" user. i was unable to cache the key for that user, so i decided to create a new user, which i assign as the identity of the application pool in IIS. because i created this user, i am able to cache the key in the registry (just using cmd).
来源:https://stackoverflow.com/questions/4313834/plink-pageant-not-working-from-asp-net