Question

The issue I'm running into is this error when I try to push to production: The deploy has failed with an error:

#<Net::SSH::AuthenticationFailed: ec2-user>

I've tried quite a few Stackoverflow solutions, but to no avail. My deploy.rb is

set :user, 'ec2-user'
set :application, 'name of application on git'
set :repo_url, 'the url from my remote origin to git'
set :deploy_to, 'where my apache points but minus the /public'

my production.rb is

role :app, %w{ip}
role :web, %w{ip} (same as above)
role :db,  %w{ip}

set :ssh_options, {
  user: "ec2-user",
  keys: %w(location to .pem file that I use to ssh in on),
  forward_agent: false,
}

I have tried creating new keys for both and using those as outlined here http://craiccomputing.blogspot.com/2008/08/ec2-ssh-and-capistrano.html cap uses admin instead of ec2-user

But still no dice.

Thoughts?

Was it helpful?

Solution

You can check the permissions on your /home/ec2-user/.ssh directory and `/home/ec2-user/.ssh/authorized_keys file. They should be something like this:

ec2-user@ec2-server:~/.ssh$ ls -la
total 24
drwx------ 2 ec2-user ec2-user 4096 Jan 31 00:39 .
drwx------ 5 root root 4096 Jan 31 21:59 ..
-rw------- 1 ec2-user ec2-user  731 Jan 31 20:39 authorized_keys
-r-------- 1 ec2-user ec2-user 3243 Jan 31 20:39 id_rsa
-r-------- 1 ec2-user ec2-user  731 Jan 31 20:39 id_rsa.pub
-rw------- 1 ec2-user ec2-user 1976 Jan 31 20:39 known_hosts

You can also try to deploy as a different user.

OTHER TIPS

I was being foolish; I provided the .pem for my Rails ec2 but not my DB ec2.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top