Eke*_*voo 4 windows-server-2008 putty sql-server sql-server-2005
我编写了一个 PS1 脚本,该脚本对文件进行 7-zip 压缩,并使用 PuTTY 的 SCP 将其存储在我的备份服务器上。我已经测试过它并且工作完美。
然后,我登录到 SQL Server 代理,并向备份作业添加一个额外的步骤,以便在备份作业完成后立即执行该脚本。它被正确调用,创建 .7z 文件,并调用 pscp.exe...并停止。我转到 SQL Server 代理的作业活动监视器并找到以下内容:
Message
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 2048 b5:f8:d2:5f:be:90:b6:be:15:d3:26:d5:c6:42:59:05
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)
Run Code Online (Sandbox Code Playgroud)
现在这是一个非交互式会话,因此我没有机会在那里按“y”。最重要的是,我不知道这个作业正在哪个用户上运行,即使我知道,我也不知道这个缓存在哪里。现在怎么办?
你可以做类似的事情
echo n | pscp file.7z user@remote.tld:/path
Run Code Online (Sandbox Code Playgroud)
这允许复制继续,而无需将密钥指纹存储在注册表中。或者你也可以
echo y | pscp file.7z user@remote.tld:/path
Run Code Online (Sandbox Code Playgroud)
它将接受问题并向用户添加密钥指纹HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys。
| 归档时间: |
|
| 查看次数: |
22713 次 |
| 最近记录: |