【发布时间】:2021-06-19 19:28:01
【问题描述】:
我已创建批处理以使用 SSH 密钥传输文件,我检查了两台服务器上的公钥和私钥映射,它工作正常。
我使用 SFTP 命令的 Windows 批处理代码如下:
open sftp://sftp_user@ssh_dest_server -privatekey="D:\directory_full_path\private_key.ppk" -rawsettings TryAgent=0 AuthKI=0 AuthGSSAPI=0
CD "/XYZ_Directory/folder1"
Put "\\full_directory_path\FILE1.zip"
exit
当我手动执行批处理时,它执行得很好,没有任何问题,但是当我从 SQL 作业(使用不同的用户)执行批处理时,它会显示以下错误:
Searching for host...
Connecting to host...
Authenticating...
Continue connecting to an unknown server and add its host key to a cache?
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 RSA key details are:
Algorithm: ssh-rsa 2048
SHA-256: finger_print_key
MD5: zz:xx:yy:xx:yy:xx:yy:xx:yy:xx:yy:xx:yy:zz:zz:00
If you trust this host,
press Yes. To connect without adding host key to the cache,
press No. To abandon the connection press Cancel.
In scripting, you should use a -hostkey switch to configure the expected host key.
(Y)es, (N)o, C(a)ncel (10 s), (C)opy Key, (P)aste key: Cancel
Host key wasn't verified!
Host key fingerprint is ssh-rsa 2048 finger_print_key.
Authentication failed.
我已经尝试过-hostkey WinSCP 命令,但是说“未知命令”。欢迎提出建议。
我想通过 WinSCP 命令执行此链接“WinSCP”之类的操作,但在我的 Windows 批处理中自动验证主机。
【问题讨论】:
标签: sftp ssh-keys winscp sql-job