我可以使用JSCH将远程主机重新添加到known_host吗? [英] can I re-add remote host to known_host using JSCH?
问题描述
我希望能够从known_hosts中删除远程服务器密钥并再次添加。远程服务器经常更新,因此我想自动删除远程主机密钥并将其新密钥添加到known_hosts。我可以从known_hosts中删除密钥,虽然它很笨重但使用 Process
而不是通过JSCH。这有效,但每当我尝试访问服务器时都会遇到此消息:
I want to be able to remove the remote server key from known_hosts and add it again. The remote server gets updated often so I want to automatically remove the remote host key and add its new key to known_hosts. I can remove the key from known_hosts though it is clunky and uses a Process
instead of going through JSCH. This works but I encounter this message whenever I try to access the server:
The authenticity of host '192.168.1.1 (192.168.1.1)' can't be established.
RSA key fingerprint is 10:10:30:00:e7:0c:d3:18:cf:ac:42:e2:f3:51:25:bg.
Are you sure you want to continue connecting (yes/no)?
我知道可以使用UserInfo解决此消息,但我使用其他方式连接到远程服务器,例如进程
,当我运行这些命令时会出现消息。
I know it is possible to get around this message using a UserInfo but I use other ways of connecting to the remote server, such as a Process
and the message would appear when I run those commands.
是否可能使用JSCH从known_hosts中删除和添加主机ID?
Is it possible to use JSCH to remove and add a host id from known_hosts?
虽然它不使用jsch但可能相关:
如何编写程序(脚本)以从〜/ .ssh / known_hosts中删除过时的主机密钥?
推荐答案
无需以编程方式操作 known_hosts
ssh -oStrictHostKeyChecking=no remote-host
或添加
StrictHostKeyChecking no
to 的〜/ .ssh / CONFI克
。有关详细信息,请阅读 ssh_config(5)
手册页。
to ~/.ssh/config
. Read the ssh_config(5)
man page for details.
这篇关于我可以使用JSCH将远程主机重新添加到known_host吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!