oinume journal

Scratchpad of what I learned

sshで初回ログイン時に"The authenticity of host 'host' can't be established..."を聞かれないようにする設定

sshで ~/.ssh/known_hosts にないマシンにアクセスする場合

The authenticity of host 'your-host (127.0.0.1)' can't be established.
RSA key fingerprint is 7f:cd:9a:d8:1d:9a:47:3b:97:e7:8e:c3:81:c8:2e:97.
Are you sure you want to continue connecting (yes/no)?

と聞かれます。社内用のサーバなどの場合、そんなに厳しく接続先のマシンをチェックしなくてもよいのであれば、sshクライアント側の ~/.ssh/configに下記の設定を書くことでこれを聞かれないようにできます。

host 192.168.1.* 
  StrictHostKeyChecking no

~/.ssh/config ファイルのパーミッションは 600 じゃないと怒られるので

$ chmod 600 ~/.ssh/config

としておきます。これで大量のサーバに最初に初めてssh接続した時の "yes" を入力するだけの簡単な仕事から解放されます!