Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
30
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

updated at

vagrant 1.7以降は'vagrant up'した時にinsecure_keyを差し替える

vagrantをアップデートしたらゲストにログインできなくなって焦った。
原因はタイトルの通り。

ちゃんと見てなかったけどログにも出てた。

    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if its present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...

この機能を無効化したい場合、Vagrantfileで以下を設定する

Vagrantfile
  config.ssh.insert_key = false

ゲストにログインする際にvagrant sshしない(主にWindowsな)人はご注意を。

※参照
https://twitter.com/mitchellh/status/525704126647128064

もう面倒だからRakeからTeraTerm呼び出すtask作った。

Rakefile
desc 'login with TeraTerm SSH'
task :ssh do
  host, port, user, keyfile = nil, nil, nil, nil
  `vagrant ssh-config`.each_line do |l|
    host = l.sub('HostName','').strip if l.strip.match(/^HostName\s/)
    port = l.sub('Port','').strip if l.strip.match(/^Port\s/)
    user = l.sub('User','').strip if l.strip.match(/^User\s/)
    keyfile = l.sub('IdentityFile','').strip if l.strip.match(/^IdentityFile\s/)
  end
  spawn({"PATH" => "C:\\Program Files\\teraterm"}, "ttermpro #{host}:#{port} /ssh /auth=publickey /user=#{user} /keyfile=#{keyfile}")
end
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
30
Help us understand the problem. What are the problem?