4

I currently use Vagrant and Chef to provision a VM and setup my PHP based project. This includes running composer install which essentially does a git clone of a number of private repositories.

After setting up ssh agent forwarding as outlined in the docs and the answers here: How to use ssh agent forwarding with "vagrant ssh"? I have successfully got it working.

The problem I'm having is when ever I boot a VM, provision a VM or SSH into a VM I'm now asked for vagrants default password, see examples below:

==> web: Waiting for machine to boot. This may take a few minutes...
web: SSH address: 192.168.77.185:22
web: SSH username: vagrant
web: SSH auth method: private key
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
vagrant@192.168.77.185's password:

Example 2

➜  vagrant git:(master) ✗ vagrant ssh
vagrant@192.168.77.185's password:

This is pretty inconvenient as I work across a number of projects, including destroying and creating some a number of times a day (Chef test kitchen). Is there anyway to automatically use my public key as well so I don't need to continually enter a password?

Community
  • 1
  • 1
Nick
  • 1,219
  • 1
  • 13
  • 24

1 Answers1

1

I ran into a similar issue recently after creating a new Vagrant box from scratch. The problem turned out to be old entries in ~/.ssh/known_hosts (on OS X).

Try the following (assumes OS X or linux):

  1. ssh into your Vagrant machine

  2. type ip addr or ifconfig or the like (depending on your OS)

  3. take note of the IP addresses listed, including 127.0.0.1

  4. on your host machine, run ssh-keygen -R {vm-ip-address} (make sure to include 127.0.0.1 and [127.0.0.1]) for the addresses in step 3

  5. confirm the relevant entries have been removed from ~/.ssh/known_hosts

  6. vagrant reload

  7. vagrant ssh

Alternatively, you can just delete/move/rename the ~/.ssh/known_hosts file, though this will require reconfirming authenticity again for multiple machines you've already ssh'd to.

I hope that helps.

Reference: http://www.geekride.com/ssh-warning-remote-host-identification-has-changed/

user3006381
  • 2,735
  • 3
  • 23
  • 32