每次尝试使用 SSH 连接服务器时,都会收到以下提示。我输入“是”,但是有没有办法避免这个?
The authenticity of host '111.222.333.444 (111.222.333.444)' can't be established.
RSA key fingerprint is f3:cf:58:ae:71:0b:c8:04:6f:34:a3:b2:e4:1e:0c:8b.
Are you sure you want to continue connecting (yes/no)?
Run Code Online (Sandbox Code Playgroud)
小智 298
使用-o
选项,
ssh -o "StrictHostKeyChecking no" user@host
Run Code Online (Sandbox Code Playgroud)
Jim*_*red 139
将以下行添加到/etc/ssh/ssh_config
...的开头
Host 192.168.0.*
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
Run Code Online (Sandbox Code Playgroud)
选项:
*
允许不受限制地访问所有 IP。/etc/ssh/ssh_config
全局配置或~/.ssh/config
用户特定配置。见http://linuxcommando.blogspot.com/2008/10/how-to-disable-ssh-host-key-checking.html
Pau*_*l R 31
您应该只在第一次连接到新主机时获得此信息。响应后yes
,主机将被存储,~/.ssh/known_hosts
下次连接时不会收到提示。
请注意,如果~/.ssh/known_hosts
由于任何原因(例如权限问题)无法写入,那么您每次连接时都会收到提示。
sle*_*ske 11
最好的方法(因为它不会牺牲安全性)是从一个客户端连接到所有计算机一次(每次都会提示您,总是回答是)。正如在另一个答案中指出的那样,密钥将存储在 ~/.ssh/known_hosts 中。然后将此文件复制到您以后可能想要连接的每台客户端计算机(可能是您使用的每个用户帐户)。然后所有这些帐户将“知道”计算机,因此没有提示。
与仅禁用提示相比的优势在于,SSH 实际上可以检查是否存在 MITM 攻击。