Host key wasn't verified!

Advertisement

sql101
Joined:
Posts:
1
Location:
USA

Host key wasn't verified!

Hi,
I am using the script tool to ftp to our secure GTP site. Could you please help me to see which part went wrong? It is complaining about the hostkey when running through SQL Analyser but no problem if I typed them manually in command prompt

I have a batch file sftp_test.bat with one line command
WinSCP.com /script=D:\sftp_test.txt
sftp_test.txt contains the following
option batch off
option confirm off
open username:pasword@site
Put d:\TestYYYYMMDD.txt
close
exit
I have no problem running it by double clicking it or through the NY scheduler. But I can not run through SQL (I want to schedule as a SQL Job then with all the notification benefits)

When I run through SQL analyser
exec master.dbo.xp_cmdshell 'D:\sftp_test.bat'
here is the result I got
NULL
C:\Windows\system32>WinSCP.com /script=D:\Uploads\sftp_CAPSJob.txt 
batch           off       
confirm         off       
Searching for host...
Connecting to host...
Authenticating...
The server's host key was not found in the cache. You have no guarantee that the server is the computer you think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 6d:c9:34:0e:8a:bb:3e:26:3a:75:9d:38:1a:13:11:0e
If you trust this host, press Yes. To connect without adding host key to the cache, press No. To abandon the connection press Cancel.
Continue connecting and add host key to the cache?
(Y)es, (N)o, C(a)ncel, (C)opy Key: Cancel
Host key wasn't verified!
Authentication failed.
NULL
But I want to be able to use SQL agent instead of the cmd prompt or scheduler

much thanks

Reply with quote

Advertisement

tsantony
Donor
Joined:
Posts:
7

Re: Host key wasn't verified!

hi,

this is antony here, did you get the answer for your question? i'm also facing the same issue.
please help me.

regards, Antony

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: Host key wasn't verified!

Please read:
https://winscp.net/eng/docs/scripting#hostkey

If that does not help, attach a full log file showing the problem (using the latest version of WinSCP).

To generate log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you may email it to me. You will find my address (if you log in) in my forum profile. Please include link back to this topic in your email. Also note in this topic that you have emailed the log.

Reply with quote

tsantony
Donor
Joined:
Posts:
7

Re: Host key wasn't verified!

Hi,

thanks a lot, I found the answer.

I have include the /privatekey and /hostkey, then I got the answer.

Thanks again :D
Regards, Antony

Reply with quote

Advertisement

You can post new topics in this forum