Emil Salageanu
Emil Salageanu

Reputation: 1057

Vagrant Authentication failure after packaging - private key missing

I create VM with vagrant starting from a base box centos-6.5. I made some changes, then I removed the file /etc/udev/rules.d/70-persistent-net.rules from the guest and packaged it. I added the new box to vagrant and started up:

vagrant package --base vm_name
vagrant box add centos-6.5_mine package.box
vagrant up

Vagrant is not able to ssh the new VM:

default: Warning: Authentication failure. Retrying...

I noticed that the file

.vagrant/machines/default/virtualbox/private_key 

is missing in the new vm's vagrant folder. Adding the private_key from the initial vm's folder does the trick but it is still not a solution: the new vm does not work out of the box.

Does anybody know how to solve this ?

thanks

Upvotes: 6

Views: 3121

Answers (2)

Emil Salageanu
Emil Salageanu

Reputation: 1057

In order to be able to distribute the vm and make it work out of the box (insecurely), I added the vagrant public key (https://github.com/mitchellh/vagrant/tree/master/keys) to .ssh/authorized_keys. Users of the box do not need to add any additional ssh configuration to get started.

Upvotes: 4

acfreitas
acfreitas

Reputation: 1397

You can try SSH Settings in your Vagrantfile

config.ssh.private_key_path = 'path/your_private_key'

config.ssh.insert_key = false

Upvotes: 0

Related Questions