SFTP SSH Hostkey match works but fails under SQL Agent Job

Advertisement

Greg Munson
Joined:
Posts:
2

SFTP SSH Hostkey match works but fails under SQL Agent Job

Running WinSCP 5.7.7 on windows 2012 server, SQL 2014 standard and SSDT v12 under MS Visio Studio 2013;
Have an SSIS package using Execute Process task to launch Batch file which launches WinSCP to connect SFTP to server using ID:pwd and hostkey fingerprint validation. When running SSIS package from SSDT and/or SSMS under my ID- all good - see last seesion snipit in attached logfile; however when running same package (eg same batch file and winscp script) under SQL Server Agent Job schedule - it gives error that host key does not match - yet even in log printout the keys are the same (see first snipit in attached file). I'm guessing it's some hidden code page or undisplayable character translation bug? Any help or suggestions?
this is snip of winscp script file
Logfile content:
"%PROGRAMFILES(x86)%\WinSCP\WinSCP.com" /log=D:\Card_UCCE_CDW_Extract\Logfiles\winscplog.txt /loglevel=1 /script=D:\Card_UCCE_CDW_Extract\Program_Files\Hadoop_Connection.txt /parameter // %*

Winscp scipt file:
open %1% "-hostkey=""%4%"""
cd %3%
ls
put %2%
ls
exit
close
  • errorexamplelog.txt (13.89 KB, Private file)
Description: Log file of error when using SQL Agent (COF\sql_agent_user) and success under my ID (COF\a-dcs032)
(scrubbed password but not client domain names - please do no post file as-is)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: SFTP SSH Hostkey match works but fails under SQL Agent Job

You have too many quotes there.

It should be:

open %1% -hostkey="%4%"

This works too (but the above is preferred):

open %1% "-hostkey=%4%"

Reply with quote

Greg Munson
Joined:
Posts:
2

Thank-you....had been playing with quotes but it was originally giving a 'too many parameters' error - then the confusion was it finally "worked", even with those extra quotes, under my ID - falsity was that (apparently) it was using a key cached in the registry and not the key I was passing to it (unfortunately it never indicated that!?)...set /ini=nul and it started failing on my ID as well ....then was able to fix both with your correction to quotes.
Is there any way to see the indication that it checked the cached key 'under the covers' in case others encounter similar feature?
Thanks

Reply with quote

Advertisement

You can post new topics in this forum