Running Putty through Agent, package hangs.

  • I'm running into a odd error using Putty in one of my packages and having it scheduled through the agent. The package hangs (runs indefinitely) when executing using a proxy with credentials X. If I log into the machine the agent is on (using credentials X) and run the job through the agent, the job runs fine.

    What I believe is happening is that the task is waiting for someone to accept the hostkey of the server I'm connecting to using plink.

    We're moving from running all our jobs from a windows xp box to a windows server 2008 box. Never had this problem with the jobs on the xp box, and I've accepted the hostkey on the 2008 machine with the credentials that the job is running under.

    Any thoughts??

  • as a followup. I know that Putty reads hostkeys from HKEY_HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys

    for some reason the package, when executed through the agent using my credentials can't read from that location, but it can if I'm logged into the machine.

    I've tried modifying my pacakge by adding a vb script first to add the hostkey to the registry but I get errors saying that access to the registry key is denied.

    I'm logged into the agent with a sql server account.

  • Another interesting update, still no solution but I think I've isolated the problem better.

    So putty reads stored host keys from hkey_current_user\software\blah blah. I've logged onto the SSIS machine and manually run putty and accepted the hostkey. If I stay logged into the SSIS server and run the job through the agent it runs fine. The job is run under a proxy using my credentials.

    If I log out of the server and run the job using the proxy with my credentials, the job doesn't run.

    So I created a package that writes to the hkey_current_user\blah blah then reads that value and logs it into a table. I also log the values of HKEY_CURRENT_USER\Identities "Default User Id" and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer "Version".

    When I run this job using the proxy with my credentials. It returns nothing for the value that was just written, returns nothing for "Default User Id" but returns the version of IE on the SSIS server.

    i'm thinking that jobs run by the agent, even under a proxy, just don't have access to HKEY_CURRENT_USER. Does anyone know anything about this??

  • Have you logged into the server using the proxy account, run and saved the host key manually?

    I had to do something similiar with a different application when setting up a SFTP process. In that case, I had to log in under the domain account for the SQL Server Agent.

  • okay I've finally got this fixed.

    What i did was change my package to have an execute process task which executed a batch file. The batch file had this "echo Y | "C:\Putty\Plink.exe" uname@server.com -pw blah -v sh myscript.sh.

    So I guess actually writing the hostkey to the registry is immaterial. Plink.exe will connect to that server and then a challenge to accept the hostkey. The piped Y will accept it and then it continues to log in and run the script.

    The key is never actually written to the registry, but I guess it's not really necessary for putty to run. I thought the hostkey might have been used to decrypt stuff in SSH, but I guess not. I don't know encryption well. Anyway, it works!

    I do think it's interesting that the agent can't read anything from hkey_current_user though. Hope this helps someone else down the road!

  • Lynn Pettis (11/11/2011)


    Have you logged into the server using the proxy account, run and saved the host key manually?

    I had to do something similiar with a different application when setting up a SFTP process. In that case, I had to log in under the domain account for the SQL Server Agent.

    Hi Lynn,

    Thanks for the reply--yes I did do that and if I log into the server I see the hostkey in hkey_current_user. If I stay logged in and run the job (the job uses a proxy with my domain credentials) it runs fine. If I log out of the machine and run the job, it hangs; it can't read the hostkey from the registry to plink is waiting for someone to accept the key.

  • philip.m.gaudet (11/11/2011)


    Lynn Pettis (11/11/2011)


    Have you logged into the server using the proxy account, run and saved the host key manually?

    I had to do something similiar with a different application when setting up a SFTP process. In that case, I had to log in under the domain account for the SQL Server Agent.

    Hi Lynn,

    Thanks for the reply--yes I did do that and if I log into the server I see the hostkey in hkey_current_user. If I stay logged in and run the job (the job uses a proxy with my domain credentials) it runs fine. If I log out of the machine and run the job, it hangs; it can't read the hostkey from the registry to plink is waiting for someone to accept the key.

    Okay, I'm stuck and since I don't work where I did this I can't check anything to see if I missed something.

    If I may ask, what type of process are you trying setup here?

  • Lynn Pettis (11/11/2011)


    philip.m.gaudet (11/11/2011)


    Lynn Pettis (11/11/2011)


    Have you logged into the server using the proxy account, run and saved the host key manually?

    I had to do something similiar with a different application when setting up a SFTP process. In that case, I had to log in under the domain account for the SQL Server Agent.

    Hi Lynn,

    Thanks for the reply--yes I did do that and if I log into the server I see the hostkey in hkey_current_user. If I stay logged in and run the job (the job uses a proxy with my domain credentials) it runs fine. If I log out of the machine and run the job, it hangs; it can't read the hostkey from the registry to plink is waiting for someone to accept the key.

    Okay, I'm stuck and since I don't work where I did this I can't check anything to see if I missed something.

    If I may ask, what type of process are you trying setup here?

    the technical reason is that we've got to execute a script on a server (linux) that hosts a db2 database. the script connect to the database, bulk insert a file (ftp'd earlier on in the job to the server), and then run a bunch of queries on the db2 database to set up a couple tables which are then copied over as the last step in the job.

    but it's good now--don't know if you saw the post above but I got it to work using a batch file and piping a "Y" into plink.

  • Oh my god! You are awesome!! I just tried what you said and it works perfectly..

    Was stuck with is for 2 days!!

    Thank you so much!

  • awesome! glad it helped someone. I remember banging my head on it for far too long!

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply