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: 18.104.22.168 (Net::SSH::AuthenticationFailed: Authentication failed for user firstname.lastname@example.org)
Note: 22.214.171.124 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 => '126.96.36.199' 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.