SSH Permission denied (publickey)

0

I have 2 EC2 instances (ip-172-30-0-196 and ip-172-30-0-194). But I can't do ssh from 194 to 196, and vice-versa. The ssh error from 194 is here.

Both hosts have the ssh files with the same permissions [2]. Why I can't do ssh between instances?

[2]

ubuntu@ip-172-30-0-196:~/Programs$ ls -altr ~/.ssh/
total 24
-rw-r--r-- 1 ubuntu ubuntu  404 Feb  2 17:41 id_rsa.pub
-rw------- 1 ubuntu ubuntu 1675 Feb  2 17:41 id_rsa
-rw-r--r-- 1 ubuntu ubuntu  444 Feb  2 18:22 known_hosts
-rw------- 1 ubuntu ubuntu  406 Feb  2 18:26 authorized_keys

xeon123

Posted 2016-02-02T18:35:04.053

Reputation: 193

1how did you create the files? Do you have any special configuration? What are permissions on the ~/.ssh/ directory itself? – Jakuje – 2016-02-02T18:49:30.130

Answers

0

There are a number of possible issues, including

  1. A firewall running on one or both boxes (iptables -vnL should list the firewall rules, look to see if port 22 is allowed)

  2. Some kind of additional limiting is occurring - for example SELinux or Apparmor. (if cat /selinux/enabled = 1, you are running selinux, try temporarily disabling it). I've seen this on quite a few CentOS 6 installs.

  3. It could be a configuration option in /etc/ssh/sshd_config - for example an "AllowUsers" directive may limit who can log in.

(BTW, your permissions look OK).

davidgo

Posted 2016-02-02T18:35:04.053

Reputation: 49 152