LoginSignup
18
15

More than 5 years have passed since last update.

RubyのNet::SSHでknown_hostsを無視する

Last updated at Posted at 2014-05-02

dockerのコンテナをserverspecを使ってNet::SSH経由のテストしたりすると ~/.ssh/known_hosts が肥大化したりverifyに失敗したりする。閉じた環境に限定されているので全体のknown_hostsを見なくてもいいだろうとNet::SSHのオプションに追加してみる。

# ...
options = {
  paranoid: false,
  user_known_hosts_file: '/dev/null',
}
Net::SSH.start(host, user, options)
  • paranoid: false は -o StrictHostKeyChecking=no
  • user_known_hosts_file: は -o UserKnownHostsFile=/dev/null

相当(のはず)。

参考:
- net-ssh/net-ssh
- Net::SSH.start

18
15
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
18
15