I had shutdown my VirtualBox/Vagrant for a while and possibly had a system upgrade or messed around with my SSH keys. Either way, upon starting up again, I found that I no longer could use my SSH key to login. Not sure what happened, but here’s what I did to resolve the issue.
The issue is described over on github where you can see the full article. But for myself, I’m using Vagrant 1.8.1 which is a little older than what’s proposed as a solution in the article. Nonetheless, I managed to fix it with the suggestions. The gist of the solution goes like this:
- Go into your vagrant box manually. You will need to use “vagrant” as your password if you never bothered changing it.
- From your root vagrant directory, run the commands:
wget https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -O .ssh/authorized_keys chmod 700 .ssh chmod 600 .ssh/authorized_keys chown -R vagrant:vagrant .ssh
- logout out of the box and run vagrant halt
- Locate your Vagrantfile (on my mac, it’s under ~/Homestead/Vagrantfile) and add the “config.ssh.insert_key = false”. It might look like the following:
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION = "2"
homesteadYamlPath = File.expand_path("~/.homestead/Homestead.yaml")
afterScriptPath = File.expand_path("~/.homestead/after.sh")
aliasesPath = File.expand_path("~/.homestead/aliases")
require_relative 'scripts/homestead.rb'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exists? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
end
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
end
config.ssh.insert_key = false
end
- Run vagrant up
After these things, the warning should go away.
(Visited 109 times, 1 visits today)
Leave a Reply
You must be logged in to post a comment.