Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication failed for user #1786

Closed
JohnMerlino2 opened this issue Oct 12, 2016 · 3 comments
Closed

Authentication failed for user #1786

JohnMerlino2 opened this issue Oct 12, 2016 · 3 comments

Comments

@JohnMerlino2
Copy link

I am able to ssh into my ec2 instance with my user without issue. However, when I try it with capistrano, I get errors:

cap staging deploy:setup

cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as myuser@ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com: Authentication failed for user myuser@ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com

Net::SSH::AuthenticationFailed: Authentication failed for user myuser@ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com

I have the following in staging.rb:

server 'ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com',
user: 'myuser',
roles: %w{web db},
ssh_options: {
keys: %w("/home/myuser/.aws/aws_myuser/myuser-key-pair-useast.pem"),
forward_agent: false,
auth_methods: %w(publickey)
}

Yet without capistrano, no issue:

ssh -i ~/.aws/aws_myuser/myuser-key-pair-useast.pem myuser@ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com

Why is this happening? It is really time-consuming trying to figure this out.

@leehambley
Copy link
Member

Please try setting your SSH options in a .ssh/config file for the host, to rule out the parsing of the options you have passed via this hash to the server … option... I believe you are using v2x syntax with v3 and thus your input is doing nothing.

Please stick to the input template for new issues in future, it includes information we require to be able to help you.

@mattbrictson
Copy link
Member

%w("/home/myuser/.aws/aws_myuser/myuser-key-pair-useast.pem")

Looks like you have a typo here. This is probably what you want (remove the quotes):

%w(/home/myuser/.aws/aws_myuser/myuser-key-pair-useast.pem)

@mattbrictson
Copy link
Member

@JohnMerlino2 I assume this is resolved. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants