Mac – VM refuses key on Windows

puttysshvagrantvirtual machinevirtualbox

My Vagrant VM is up and running, but if i check netstat, it is just ESTABLISHED but not LISTENING.

  TCP    192.168.56.1:139       0.0.0.0:0              LISTENING
  TCP    192.168.56.1:50973     192.168.56.101:22      ESTABLISHED

Thouz as i found out, this apparently is not an issue, I can not connect to it using putty because it refuses my key.

login as: vagrant
Server refused our key
vagrant@192.168.56.101's password:

I am using a private key without passphrase that is stored locally and known to putty.
I configured vagrant to use it in the config.yaml

ssh:
    host: null
    port: null
    private_key_path: ./puphpet/files/dot/ssh/vagrant_key

In the vagrant_key Folder i have the public key as vagrant and vagrant.pub and the private key as vagrant.ppk

Anyone any Ideas or Hints?


EDIT: i adjusted my Public SSH File (vagrant.pub) from Puttygen which now looks like:

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAsD+KWzLA96mAM9hkwy/xWdRT6+aUJ72M2ZyrZMk/GZTGfZxPXKgNvhPB/2AF3tVikcp8XNw5iVN/Lfu6+9JCzeDl3E4r9Xcbx0zCeclOY8ofLCD1rsKRCC/E33aew/y4QMkGfZQeXj3mVsuQxuPrr5tCTziKUKz7QTNn/MLINa1YuqsO5aqO1ujCeT2RjwShXVcvjFzT9/fRXiaH0M1hygcuIYY3T8MOp6dGPoBHB6WOuVgv5X+BTsilRuL+mQTWnZZw93NF2ySgEZFHwPoMLBCCc+A1quZV+aoDBTaVsOdsSGeCWMAW5oytsG7M/ATUDmZOI7D+M9UWIXkdvImusQ== rsa-key-20140423

It still doesn't work.


EDIT: While i couldn't fix my Putty Problem (yet), thanks to @user1301428 i found a way to connect to my VM using vagrant ssh, which can be used under windows if you have the ssh.exe from git in your PATH Variable. Read this Stackoverflow article here for help.

Best Answer

Try using this public key instead:

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAsD+KWzLA96mAM9hkwy/xWdRT6+aUJ72M2ZyrZMk/GZTGfZxPXKgNvhPB/2AF3tVikcp8XNw5iVN/Lfu6+9JCzeDl3E4r9Xcbx0zCeclOY8ofLCD1rsKRCC/E33aew/y4QMkGfZQeXj3mVsuQxuPrr5tCTziKUKz7QTNn/MLINa1YuqsO5aqO1ujCeT2RjwShXVcvjFzT9/fRXiaH0M1hygcuIYY3T8MOp6dGPoBHB6WOuVgv5X+BTsilRuL+mQTWnZZw93NF2ySgEZFHwPoMLBCCc+A1quZV+aoDBTaVsOdsSGeCWMAW5oytsG7M/ATUDmZOI7D+M9UWIXkdvImusQ==

and add this to the authorized_keys file.

There is an issue with the format of Putty-generated keys when used with SSH, it might easily be the cause of that error message you are seeing.

Update With regards to how to configure all this on Windows, have a look at this question on stackoverflow, maybe it will point you in the right direction.

Update 2 Try saving the public key as insecure_public_key.ppk (see this article)