예를 들어 StrictHostKeyChecking 옵션을 사용하십시오.
ssh -oStrictHostKeyChecking=no $h uptime
이 옵션은 ~ / .ssh / config에 추가 할 수도 있습니다. 예 :
Host somehost
Hostname 10.0.0.1
StrictHostKeyChecking no
호스트 키가 변경되면이 옵션을 사용하더라도 경고 메시지가 표시됩니다.
$ ssh -oStrictHostKeyChecking=no somehost uptime
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
31:6f:2a:d5:76:c3:1e:74:f7:73:2f:96:16:12:e0:d8.
Please contact your system administrator.
Add correct host key in /home/peter/.ssh/known_hosts to get rid of this message.
Offending RSA key in /home/peter/.ssh/known_hosts:24
remove with: ssh-keygen -f "/home/peter/.ssh/known_hosts" -R 10.0.0.1
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
ash: uptime: not found
호스트를 자주 다시 설치하지 않는 경우 -oUserKnownHostsFile=/dev/null
옵션을 사용하여 보안 수준을 떨어 뜨릴 수 있습니다 (그러나 자주 변경하는 호스트 키에 더 편리함) . 이렇게하면 수신 된 모든 호스트 키가 삭제되므로 경고가 발생하지 않습니다.
18.04에서는 새로운 가능성이 StrictHostKeyChecking=accept-new
있습니다. 보낸 사람 man 5 ssh_config
:
If this flag is set to “accept-new” then ssh will automatically
add new host keys to the user known hosts files, but will not
permit connections to hosts with changed host keys. If this flag
is set to “no” or “off”, ssh will automatically add new host keys
to the user known hosts files and allow connections to hosts with
changed hostkeys to proceed, subject to some restrictions.
yes
"y"를 출력하기 때문에 운이 좋았을for h in $SERVER_LIST; do yes yes | ssh $h "uptime"; done
것입니다. ").