2
1

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用に単一のknown_hostsを生成する方法

Posted at

毎回ssh初回接続時に聞かれる yes/no で勝手にknown_hostsに追記されてたけど、今回Cloud Buildで個別のknown_hostsを用意したかった。

けど、いまいち自分の ~/.ssh/known_hosts から該当サーバー用のを切り貼りして作るのがイケてない気がしたので諦めて調べた。

ssh-keygen -H some.host.name.com >> known_hosts

-H で 出力されるipをハッシュ化してくれるらしい。

sshはそのままハッシュ化されたipで内容がわかるので出力したファイルはそのまま使えるっぽい。

また、公開鍵が複数用意されてる場合、

ssh-keygen -H -t rsa some.host.name.com >> known_hosts

のように -t rsa などと、鍵の種類を特定できる模様。

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?