Ssh初次連線忽略know_hosts詢問
連線新的SSH Client時會因為~/.ssh/know_hosts中無key存在,而會詢問
$ ssh root@my.ip_address
The authenticity of host 'my.ip_address (my.ip_address)' can't be established.
RSA key fingerprint is 2f:64:60:3b:01:54:31:d7:68:f1:ca:50:ee:2a:5c:43.
Are you sure you want to continue connecting (yes/no)?
這時沒有回答yes還真的不給你連線...@@
這在需要自動延展新的server時候,如果遇到這樣的問題...就麻煩拉!
下面有兩個可以避開know_hosts的詢問:
1.連線時候加上參數“-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no”
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no username@ip_adreess
2.修改/etc/ssh/ssh_config檔案,打開StrictHostKeyChecking,並設定為no
# Host *
# ForwardAgent no
# ForwardX11 no
# PubkeyAuthentication yes
# PasswordAuthentication yes
# FallBackToRsh no
# UseRsh no
# BatchMode no
# CheckHostIP yes
StrictHostKeyChecking no
# EscapeChar ~