Capistrano authentication failure on a Vagrant VM

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: 33.33.33.33 (Net::SSH::AuthenticationFailed: Authentication failed for user vagrant@33.33.33.33)

Note: 33.33.33.33 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 => '33.33.33.33'
    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.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *