我们有一个在默认 Windows 本地系统帐户下运行的 Windows 服务。此服务尝试使用 pscp.exe 将文件传输到服务器。这是我们触发的确切命令:
pscp.exe -batch -r -q -v -l **** -pw **** C:/temp/test my-server-host-name:/bnrr2p3
Run Code Online (Sandbox Code Playgroud)
请注意使用 --batch 选项以避免任何提示。现在这失败了,因为服务器名称尚未添加到已知主机列表中,并出现以下错误:
Looking up host "my-server-host-name"
Connecting to 10.89.3.108 port 22
Server version: SSH-2.0-Sun_SSH_1.1.4
Using SSH protocol version 2
We claim version: SSH-2.0-PuTTY_Release_0.62
Doing Diffie-Hellman group exchange
Doing Diffie-Hellman key exchange with hash SHA-1
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 …Run Code Online (Sandbox Code Playgroud)