gpt4 book ai didi

vba - 在 VBA + Excel 中使用 pscp.exe 将文件从 Windows 传输到 Unix 服务器时,获取 "The server' 的主机 key 未缓存在注册表中

转载 作者:行者123 更新时间:2023-12-04 19:48:39 26 4
gpt4 key购买 nike

我已经在 Excel 上编写了 VBA 代码。我正在尝试使用 SFTP 和文件 pscp.exe 将文本文件传输到我的服务器。不会传输文件,会显示pscp.exe窗口。

我会看到以下消息:

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 key fingerprint is: ssh-rsa XXXX XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX If you trust this host, enter "y" to add the key to PuTTY's cache and carry on connecting. If you want to carry on connecting just once, without adding the key to the cache, enter "n". If you do not trust this host, press Return to abandon the connection. Store key in cache? (y/n)

我该如何解决我的问题?

Dim Polku As String
Polku = "/"

Dim Palvelin As String
Palvelin = "grid1.example.xxx"

Dim Kayttajatunnus As String
Kayttajatunnus = "user@example.xxx"

Dim Salasana As String
Salasana = "Password2012"

Dim Tiedosto As String
Tiedosto = "filename.txt"

Dim PolkuOhjelma As String
Dim PolkuTiedosto As String

If Right$(ActiveWorkbook.Path, 1) <> "\" Then
PolkuOhjelma = ActiveWorkbook.Path & "\pscp.exe"
PolkuTiedosto = ActiveWorkbook.Path & "\" & Tiedosto
Else
PolkuOhjelma = ActiveWorkbook.Path & "pscp.exe"
PolkuTiedosto = ActiveWorkbook.Path & Tiedosto
End If

Dim Siirtokomento As String
Siirtokomento = Chr$(34) & PolkuOhjelma & Chr$(34) & " -sftp -l " & Kayttajatunnus & _
" -pw " & Salasana & " " & Chr$(34) & PolkuTiedosto & Chr$(34) & " " & _
Palvelin & ":" & Polku

Debug.Print Siirtokomento

Shell Siirtokomento, vbNormalFocus

最佳答案

你应该使用 -hostkey switch明确指定可信主机 key 的指纹。

-hostkey XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX

关于vba - 在 VBA + Excel 中使用 pscp.exe 将文件从 Windows 传输到 Unix 服务器时,获取 "The server' 的主机 key 未缓存在注册表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42841923/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com