new to Vagrant, getting ssh private key errors

3,610 views
Skip to first unread message

Monte Milanuk

unread,
Apr 12, 2015, 9:55:18 PM4/12/15
to vagra...@googlegroups.com
So... I've played with vagrant a very little bit in the past.  Decided to renew the acquaintance, and downloaded a new .deb for the current version and installed it to my laptop (running Ubuntu 14.04).  Following the 'Getting Started' guide @ vagrantup.com... all goes well up until this point:

==> default: Waiting for machine to boot. This may take a few minutes...
   
default: SSH address: 127.0.0.1:2222
   
default: SSH username: vagrant
   
default: SSH auth method: private key
   
default:
   
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...
The private key to connect to the machine via SSH must be owned
by the user running Vagrant. This is a strict requirement from
SSH itself
. Please fix the following key to be owned by the user
running
Vagrant:


/srv/data/VirtualBox/vagrant/test/.vagrant/machines/default/virtualbox/private_key
monte@machin
-shin:/srv/data/VirtualBox/vagrant/test$


Now... I've tried changing the permissions on that file... no go, either as a user or as root.  I'm pretty fuzzy on what/where else I should be editing to address the problem.  Did some digging around on StackOverflow, Reddit, etc. and saw some things that were close - apparently some stuff changed with the release of 1.7.x regarding ssh... all well and fine, but the basic intro tutorial makes *no* mention of anything that needs to be done differently, or what this 'fix' I'm supposed to do even looks like, leaving a new user (me) kind of high and dry.  Do I edit the VagrantFile in the directory where I'm storing/running the box, or some file buried under ~/.vagrant.d, or both?  Right now I'm still stuck, so if someone could kindly point me in the right direction, I'd greatly appreciate it.

Thanks,

Monte

dragon788

unread,
Apr 13, 2015, 11:16:29 AM4/13/15
to vagra...@googlegroups.com
Until you figure out the issue, you can try the workaround in this comment. https://github.com/mitchellh/vagrant/issues/5059#issuecomment-68041037 

Basically config.ssh.insert_key = false into your Vagrantfile should prevent it from changing the keys, which means it will keep using the old one. 

For your issue it sounds like the place that vagrant is trying to store the new private key file has too loose of permissions, so you need to chmod the .ssh folder that they live in to 600, which the .pub being 644 permissions.

Monte Milanuk

unread,
Apr 13, 2015, 7:00:36 PM4/13/15
to vagra...@googlegroups.com


On Monday, April 13, 2015 at 8:16:29 AM UTC-7, dragon788 wrote:
Until you figure out the issue, you can try the workaround in this comment. https://github.com/mitchellh/vagrant/issues/5059#issuecomment-68041037 

Basically config.ssh.insert_key = false into your Vagrantfile should prevent it from changing the keys, which means it will keep using the old one. 

I added that line to the file `Vagrantfile` located in `/srv/data/Virtualbox/vagrant/test`, which is the base directory the box I'm attempting to make.

Didn't seem to make any difference.
 
For your issue it sounds like the place that vagrant is trying to store the new private key file has too loose of permissions, so you need to chmod the .ssh folder that they live in to 600, which the .pub being 644 permissions.

/srv/data/VirtualBox/vagrant/test/.vagrant/machines/default/virtualbox/private_key
 
monte@machin-shin:/srv/data/VirtualBox/vagrant/test$

 
Well, that is part of the question.  Are we talking my personal `~/.ssh/` folder?  Cuz its permissions are 0600, and id_rsa.pub within has permissions of 0644.  If we're talking the directory shown above: `/srv/data/VirtualBox/vagrant/test/.vagrant....virtualbox/`, then no it isn't, and neither is the `private_key` file - and *vagrant* created them, and I *can't* change the permissions on them.

Thanks,

Monte

dragon788

unread,
Apr 13, 2015, 7:51:41 PM4/13/15
to vagra...@googlegroups.com
Monte, can you post a link to the Vagrantfile you are using? Do you have any symlinks or anything setup to redirect your home directory over to another location or is your storage path /srv/data ?

Monte Milanuk

unread,
Apr 13, 2015, 8:16:00 PM4/13/15
to vagra...@googlegroups.com
On 04/13/2015 04:51 PM, dragon788 wrote:
> Monte, can you post a link to the Vagrantfile you are using? Do you
> have any symlinks or anything setup to redirect your home directory
> over to another location or is your storage path /srv/data ?

On this particular machine, I have /dev/sdb1 (second 500GB HDD) mounted
under /srv/data, for some of my 'bigger' things, such as VMs, etc.
Hence the path `/srv/data/Virtualbox/vagrant/test`, `test` being the
vagrant box I'm trying to create by following the tutorial after cd'ing
there inside a terminal window.

Contents of the Vagrantfile inside `test` (after removing all the
comments for brevity):

1 # -*- mode: ruby -*-
2 # vi: set ft=ruby :
3
4 Vagrant.configure(2) do |config|
5 config.vm.box = "hashicorp/precise32"
6 config.ssh.insert_key = false
7 end


In the past, I had an earlier version of Vagrant (1.6.5, IIRC), and had
no problems with getting stuff up and running.

Ethan S.

unread,
Apr 13, 2015, 9:58:13 PM4/13/15
to vagra...@googlegroups.com
Are you using a bind mount or a symlink to get /dev/sdb1 mounted at /srv/data? I ask because I've encountered some weird behavior with Vagrant and certain kind of mount methods, eg on Windows using subst makes Vagrant freak out.

--
You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/FeXfcxpQlVA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Monte Milanuk

unread,
Apr 16, 2015, 11:11:00 AM4/16/15
to vagra...@googlegroups.com
On 04/13/2015 06:58 PM, Ethan S. wrote:
> Are you using a bind mount or a symlink to get /dev/sdb1 mounted at
> /srv/data? I ask because I've encountered some weird behavior with
> Vagrant and certain kind of mount methods, eg on Windows using subst
> makes Vagrant freak out.

Nope. Mounted traditionally @ boot - its formatted ntfs so I can access
various things stored on there (VirtualBox, videos, etc.) from both
Windows 7 and Linux (dual-boot).

Again, I had (briefly) vagrant 1.6.5 running there in the past with no
issues that I recall.
Reply all
Reply to author
Forward
0 new messages