I was having issues getting Capistrano to SSH into a Vagrant VM. I could shell in myself but Capistrano always returned the following error:
connection failed for: 126.96.36.199 (Net::SSH::AuthenticationFailed: Authentication failed for user email@example.com)
Note: 188.8.131.52 is my private network set up in the vagrantfile.
VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = 'precise32' config.vm.host_name = 'virtualmachine' config.vm.network "private_network", :ip => '184.108.40.206' config.vm.provider :virtualbox do |v| v.customize ["modifyvm", :id, "--memory", 4096] end end
For me, the problem only occurred with the local VM. Capistrano had no problems interacting with remove web servers via SSH.
Try changing the version of the net-ssh gem in use per this SO post. For me, locking net-ssh to 2.8.1 solved the issue. There were some Stackoverflow comments suggesting the bug reappears in newer releases.