LoginSignup
12
11

More than 5 years have passed since last update.

~/.ssh/ 以下に書き込めない環境で ssh したとき known_hosts に書き込めないエラーを抑制する

Posted at

ssh_config(5) の UserKnownHostsFile で書き込み可能なファイルを指定すれば良い。

ssh -o UserKnownHostsFile=$HOME/known_hosts のようにする。

-o StrictHostKeyChecking=no も組み合わせると初回の (yes/no) を尋ねられなくなるのでバッチ処理などを書くときに便利 (DNS spoofing に気づけなくなるなどのリスクはありえる)

$ ssh -i ~/id_rsa \
  -o UserKnownHostsFile=~/known_hosts \
  -o StrictHostKeyChecking=no \
  git@github.com
12
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
11