key authentication doesn't work for 'vagrant up' but does work otherwise on Windows 7

508 views
Skip to first unread message

George Oliver

unread,
Feb 7, 2015, 5:48:46 AM2/7/15
to vagra...@googlegroups.com
hi, 

I've been reading a lot of posts on the list and issues on Github but I can't figure this out. I have Vagrant 1.6.3, VirtualBox 4.3.20, and Windows 7 host. Password login is turned off in the guest box. If I start the guest box from VB and ssh in with Putty, key authentication works fine. However if I do 'vagrant up' I get the 

default: Warning: Connection timeout. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...

I installed vagrant-multi-putty trying to fix it. The relevant part of my Vagrantfile is

config.ssh.insert_key = false
config.ssh.private_key_path = "c:/users/george/.ssh/vagrant/id_rsa.ppk"
config.putty.private_key_path = "c:/users/george/.ssh/vagrant/id_rsa.ppk"

The path is the same one used for my key file in my Putty session. 

When I turn on the VB gui mode in the Vagrantfile, what seems to be happening is that Vagrant gets stuck on the login prompt. But I don't understand why this would happen if it's trying to use key authentication. For example if I remove the path to the key file in the Putty session, the login attempt just fails outright and doesn't stop on the login prompt. 


thanks for any advice, George

George Oliver

unread,
Feb 7, 2015, 1:32:18 PM2/7/15
to vagra...@googlegroups.com

Success!

Setting VAGRANT_LOG to debug I found this:

E, [2015-02-07T10:09:13.003848 #3168] ERROR -- net.ssh.authentication.key_manager[130d244]: could not load private key file `c:/users/george/.ssh/vagrant/id_rsa.ppk': ArgumentError (Could not parse PKey: no start line)
D, [2015-02-07T10:09:13.003848 #3168] DEBUG -- net.ssh.authentication.agent[13313e8]: connecting to ssh-agent
E, [2015-02-07T10:09:13.004348 #3168] ERROR -- net.ssh.authentication.agent[13313e8]: could not connect to ssh-agent
E, [2015-02-07T10:09:13.004348 #3168] ERROR -- net.ssh.authentication.session[1304db4]: all authorization methods failed (tried none, publickey)

So the solution was to convert the .ppk key to OpenSSH in PuttyGen, but use it only for vagrant up. The Vagrantfile then looks something like

config.ssh.insert_key = false
config.ssh.private_key_path = <your path to the OpenSSH formatted key>
config.putty.private_key_path = <your path to the Putty ppk formatted key>

Then vagrant up returns successfully and you can do vagrant putty afterwards. 

Thanks for the good docs and debug info!


George

Reply all
Reply to author
Forward
0 new messages