Unable to connect to ec2-host (errors with permission denied errors) in AWS

422 views
Skip to first unread message

Raj Desikavinayagompillai

unread,
Apr 23, 2015, 3:04:49 PM4/23/15
to ansible...@googlegroups.com

Unable to connect to ec2-host (errors with permission denied errors) in AWS.

  1. Have the following entry in inventory file
  2. Following command was executed ansible -vvv test_ansible --user ansible --private-key=/home/ansible/.ssh/id_rsa -m ping --become-user=ansible

It is trying to connect as ec2-user@ec2_remotehost |FAILED> SSH Error: Permission denied (publickey).
while connecting to ec2_remotehost:22

If this is already fixed, let me know the bug number and I can close this as duplicate.

Brian Coca

unread,
Apr 23, 2015, 3:08:57 PM4/23/15
to ansible...@googlegroups.com
This does not seem as much as a bug as a lack of permissions or some
configuration discrepancy.

Do you have ansible_ssh_user/ssh_host set for the host?
from the command line switches, you would expect ansible@test_ansible
, but you report the error as ec2-user@ec2_remotehost

--
Brian Coca

Raj Desikavinayagompillai

unread,
Apr 23, 2015, 3:15:40 PM4/23/15
to ansible...@googlegroups.com
test_ansible is a group. In that ec2_remotehost is the server defined in the inventory file as follows

[test]

  ec2_remotehost ansible_ssh_user=ansible


userid exists.


ansible> ssh ansible@ec2_remotehost -i ~ansible/.ssh/id_rsa works

Raj Desikavinayagompillai

unread,
Apr 23, 2015, 3:17:48 PM4/23/15
to ansible...@googlegroups.com
Never mind. It was typo in my /etc/ansible/hosts file.
Reply all
Reply to author
Forward
0 new messages