【发布时间】:2020-10-20 16:33:04
【问题描述】:
我正在使用 ssh 命令远程执行带有 -o **StrictHostKeyChecking=no ** 选项的 shell 脚本以绕过身份验证:
ssh -o StrictHostKeyChecking=no root@$IP '/test-script'
但是,我使用的 sh shell 不支持 StrictHostKeyChecking=no 选项:
root:~ Jeff$ ssh StrictHostKeyChecking=no root@$IP '/test-script'
Could not create directory '/home/root/.ssh'.
The authenticity of host '192.168.186.1 (192.168.186.1)' can't be established.
ECDSA key fingerprint is SHA256:KOx9T7VeRy9dJ2ug+tfnlbnG/7Fm0I5Tl/ziTkE4JaE.
Are you sure you want to continue connecting (yes/no)?
我拥有的 ssh 的所有 -o 选项是:
ssh -o help
ssh: Available options:
ExitOnForwardFailure
UseSyslog
那么,有什么方法可以提示“是”为“您确定要继续连接(是/否)吗?”远程主机上的问题?
我尝试了以下选项,但都没有奏效
ssh -o StrictHostKeyChecking=no root@$IP '/test-script' | yes
yes | ssh StrictHostKeyChecking=no root@$IP '/test-script'
yes yes | ssh StrictHostKeyChecking=no root@$IP '/test-script'
有什么方法可以运行 ssh 远程命令,阅读提示并找到这个问题“您确定要继续连接(是/否)吗?”然后输入yes?
谢谢
【问题讨论】:
-
也许
ssh -o StrictHostKeyChecking=no? -
StrictHostKeyChecking是 ssh 的一部分,而不是 sh!我想,你错过了-o。 -
yes yes?是的。 -
C 标签?为什么?标记已删除。
-
您是否阅读过 dropbear 的文档以找到其与该 openssh 选项的本地等效项?
标签: shell