Ssh – Force Capistrano to ask for password

capistranossh

I am deploying using Capistrano to a new server and having the following issue. Currently, I cannot add an SSH key to the server to log in with so I must use password authentication. However, I do have a key for another server saved in my local user account's .ssh directory.

Here is the error I get when I try to log in:

C:\Web\WebApp1>cap deploy:setup
  * executing `deploy:setup'
  * executing "mkdir -p /home2/webapp1 /home2/webapp1/releases /home2/webapp1/shared /home2/webapp1/shared/system /home2/webapp1/shared/log /home2/webapp1/shared/pids"
    servers: ["myserver.example.com"]

connection failed for: myserver.example.com (OpenSSL::PKey::PKeyError: not a public key "C:/Users/MyAccount/.ssh/id_rsa.pub")

How can I get Capistrano to ignore the existence of the key I have and let me log in with a password instead? I tried adding set :password, "myp@ssw0rd" to deploy.rb and it didn't help.


UPDATE

I followed @sysadmin1138's answer to add the following to the ssh config file:

HostName myserver.example.com
    PreferredAuthentications=password
    PubkeyAuthentication=no

Now, I get the error:

connection failed for: myserver.example.com (Net::SSH::AuthenticationFailed: webappuser)

It does not even ask for the password though. When I tried specifying the password in the config file, it still gave the same error.


Here are the relevant parts of my Capistrano config:

role :web, "myserver.example.com"

set :user, "webappuser"
default_run_options[:pty] = true # Allow Capistrano to prompt for passwords

set :deploy_to, "/home2/webapp1"

Best Answer

This is probably solveable outside of Capistrano and in SSH itself. Setting up a ~/.ssh/config file an creating an entry for your host:

HostName myserver.example.com
    PreferredAuthentications=keyboard-interactive
    PubkeyAuthentication=no

Capistrano will definitely prompt for a password if no key is present, I've done that.