在Hudson中运行脚本时,Putty不会缓存用于访问服务器的密钥 [英] Putty won't cache the keys to access a server when run script in hudson

查看:221
本文介绍了在Hudson中运行脚本时,Putty不会缓存用于访问服务器的密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的自动化过程来编写,该过程需要通过SSH将几个文件从linux服务器复制到Windows.这可以通过使用腻子来完成.

I had a simple automation process to write which needed to copy a few files from linux server to windows via SSH. This can be accomplished using putty.

SSH会验证主机的身份,如果未知,它将提示您接受主机的身份.当我手动将Linux服务器与Putty连接时,它不会提示任何信息来接受主机的身份.但是,一旦我将此自动化流程作为日程安排工作输入了Hudson.确切的消息是:

SSH, as part of the protocol, verifies the host’s identity and if not known to be correct, will prompt you to accept the host’s identity. When I manually connect the linux server with putty , it won’t prompt any information to accept the host’s identity. But once I put this automation process into Hudson as schedule job. The exact message was:

服务器的主机密钥未缓存在注册表中.你没有 确保服务器是您认为的计算机.这 服务器的rsa2密钥指纹为:ssh-rsa 1024 cc:78:13:a3:68:a6:59:7e:b8:23:2d:13:3e:66:9b:b9如果您相信这个 主机,输入"y"将密钥添加到PuTTY的缓存中并继续 连接.如果您只想进行一次连接,而无需 将密钥添加到缓存中,输入"n".如果您不信任此主机, 按回车键放弃连接.将密钥存储在缓存中? (是/否) 连接被放弃.

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 1024 cc:78:13:a3:68:a6:59:7e:b8:23:2d:13:3e:66:9b:b9 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) Connection abandoned.

通常,在主机密钥正确的情况下,您将在此处单击"Y",以便将其存储在以后的连接中.它的存储进入HKEY_CURRENT_USER \ Software \ SimonTatham \ Putty \ SshHostKeys

Usually you would hit "Y" here, assuming the host key is correct, in order to store it in future connection. The storage of this goes into the Registry under HKEY_CURRENT_USER\Software\SimonTatham\Putty\SshHostKeys

但是不幸的是,在哈德森运行的自动化过程无法通过按"Y"键将主机密钥存储在腻子缓存中进行交互.而且我也无法仅通过在dos命令下运行自动化过程来重现该问题.

But unfortunately , the automation process running in Hudson cannot do interaction by hit "Y" to store host key in putty cache. And also I cannot reproduce the issue by simply run the automation process under dos command.

有人知道如何解决问题吗?

Does anyone know how to resolve the problem?

推荐答案

echo y | pscp -i /path/to/key/file user@remote:/tmp/file  .
echo y | plink -i /path/to/key/file scripts.sh

它将第一次将主机密钥指纹打印存储到以下位置,而下次将忽略"y"

it will store host key fingureprint to following location at the first time, and will ignore "y" next time

HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys

这篇关于在Hudson中运行脚本时,Putty不会缓存用于访问服务器的密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆