I'm on a Windows 7 machine and have installed PuTTY. I'm trying to connect, but the authentication fails because of an incorrect password. But, the VM I'm connecting to doesn't have a password?

Here are the creds I'm trying to use: Host: Port: 2222 Username: vagrant Private key: c:/users//.vagrant.d/insecure_private_key

When I open PuTTY, I put in the above credentials and click open, at which point it ask for the username and I enter 'vagrant', then it asks for the password, but there isn't a password, so I get access denied?

Not sure how to get around this?


  • What fields are you filling in PuTTY? How are you giving PuTTY your private key? If you haven't specified a private key prior to connecting, most ssh servers will default to a password login. – heavyd Jan 11 '13 at 17:39

The first thing you need is a key that PuTTY can understand. PuTTY requires a .ppk file, which is not the same as the standard openSSH key file. You can use the PuTTYgen tool to generate a key or to convert an existing openSSH to a putty key.

Once you have a key, you need to tell PuTTY about it. For this you have two options:

Once you have PuTTY all setup, you need to make sure you have added your public key to the authorized_keys file. Once that is all setup you should be able to connect.

| improve this answer | |

There are a few things that could be at play:

On the "Server"

Have you verified that the public key is in the ~/.ssh/authorized_keys and ~/.ssh/authorized_keys2 of the vagrant user?

A simple way to add:

cat id_aribtratry_name.pub >> ~/.ssh/authorized_keys{,2}

(Shell expansion should do both, but may as well double check the files).

On the Host

Nothing above suggests to me that you used Puttygen to get the key for Putty, also you can configure putty to skip asking you the other things.

  1. Using Puttygen

    Open Puttygen: File > Load Private Key (in the pop-up dialog, you will need to select "All Files") to load your key.

    enter image description here

    Leave everything as it is and click "Save private key"

    enter image description here

    It will prompt you to confirm you don't want a password, I will leave that option up to you. Locally, not really a problem. But a server online - I would suggest it.

    Save it wherever as id_whatever.ppk

  2. Set up Putty (saves you time later)

    Enter the IP and Port (As you have been doing)

    enter image description here

    On the left, navigate to Connection > SSH > Auth, find your private key file in the "browse" dialog.

    enter image description here

    Navigate back to Connection > Data, specify your Auto-login username

    enter image description here

    Finally, go back to Session, and you can specify a name to save the session under.

    enter image description here

After all that, you should be able to login. That is, assuming the IP is correct. To avoid confusion, I personally would use the actual IP of the machine. But if the LO works through the other port, that is fine to use.

| improve this answer | |

your VM should have a different IP, not your loopback address.

Edit: from my experience with VMWare. I can't speak for all virtualization software.

| improve this answer | |
  • To clarify. Each and every IP v4 host has an IP numbered which leads back to itself. Both your windows 7 host and the vm should have and another IP. Those other IPs differ. – Hennes Jan 11 '13 at 17:13
  • 1
    @Bryan, he is likely using a VM running on a virtual NAT, which would explain why he's using port 2222 likely forwarded to port 22 on the guest. – heavyd Jan 11 '13 at 17:37
  • I created a VM on my machine to provide a specific rails development environemnt on my machine. See githbu here: github.com/rails/rails-dev-box I'm pointing to the private key file under my user directory. I think the issue is PuTTY is expecting the private key in a different format perhaps? – Dman100 Jan 11 '13 at 17:55
  • Vagrant forwards ports for SSH automatically, from to the VM. – Brad Apr 27 '14 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.