Vagrant SSH Tunnelling after using `vagrant ssh`

Small Hadron Collider picture Small Hadron Collider · Mar 12, 2014 · Viewed 16k times · Source

My MySQL client (Sequel Pro) is set up to connect to Vagrant over SSH. I've setup the following in my ~/.ssh/config file:

Host vagrant
  HostName 127.0.0.1
  CheckHostIP no
  Port 2222
  User vagrant
  IdentityFile ~/.vagrant.d/insecure_private_key

Everything works fine if I haven't run vagrant ssh. But once I've logged into the Vagrant box with that command Sequel Pro can no longer connect via SSH - it just says "The SSH Tunnel has unexpectedly closed." So I have to run vagrant reload before I can connect to the MySQL server.

Does anyone know how to get around this issue?

Answer

Ian Ring picture Ian Ring · Nov 14, 2014

I had the same problem, and it turned out to be an old key in my known_hosts file.

So, I did:

$ vi ~/.ssh/known_hosts

went to the line with 127.0.0.1:2200 on it, then did command dd to delete that line.
:x to save, and bam bob's yer uncle. Connection granted, long live Jambi.

I hope that saves someone some grief. Cheers.