12
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?