1
Today all of a sudden I am not able to SSH into my AWS linux instance using ec2-user as username.
I was able to do it yesterday.
I have searched for this and found that all things are in place, Security group, Key etc.
Getting this error.
login as: ec2-user
Server refused our key
ec2-user@XX.XX.XX.XXX's password:
I am confident that I am using the correct username, private key and IP-address.
FYI: The server allows password authentication as well, because we have one user per domain. That helps us to provide restricted access to developers who is managing specific websites.
I am using windows 7 and putty tool to connect to server.
I have also tried this and this, but getting same error. Seems my problem is different as I have not lost the key.
Since this is the root user. How can I recover access?
1Start to run ssh with
-vvv
to get additional information. It usually gives a clue as to what the problem might be. – Magnus – 2017-08-15T12:11:15.737Have you broken the key on your side or just use incorrect filename of the key? – Putnik – 2017-08-15T22:32:59.740
@Magnus: I am not sure about how to use
-vvv
in putty. Can you please elaborate? – Amol Chakane – 2017-08-17T10:57:27.050@Putnik: No I haven't broken the key and I am sure that I am using the correct filename. – Amol Chakane – 2017-08-17T10:58:43.837
Just add it as an argument to the ssh command. Like 'ssh -vvv user@server' – Magnus – 2017-08-17T10:59:38.673
@Magnus: In putty there is no terminal, so I cannot do that. – Amol Chakane – 2017-08-17T11:08:07.113
Aha, missed that you were using putty. Try enabling the session log under
Session
->Logging
. – Magnus – 2017-08-17T13:04:32.493@Magnus: I enabled logging in putty. It logs same error as mentioned in my question. i.e.
login as: ec2-user Server refused our key ec2-user@XX.XX.XX.XXX's password:
Do I need to choose any specific options under logging? – Amol Chakane – 2017-08-18T13:22:42.707If you can, check the access right of the
~/.ssh
directory and~/.ssh/authorized_keys
file on the server. They should be700
and600
and owned byec2-user
. – Magnus – 2017-08-18T13:31:52.990Also check
/var/log/auth.log
for clues on the server – Magnus – 2017-08-18T13:32:25.300@Magnus: Provided
700
to~/.ssh
and600
to~/.ssh/authorized_keys
but still getting same error. And there is no such file/var/log/auth.log
– Amol Chakane – 2017-08-22T11:10:29.250@Magnus: My bad, my home folder was mounted on another EBS volume and I was trying every solution on root volume. Now I resolved the issue. Thanks a ton for your guidance. – Amol Chakane – 2017-08-22T13:38:29.047
@AmolChakane I am facing same issue since yesterday, And the only change I did, I changed the permission of /home/centos since I wanted to view some files inside .aws directoty. Now I want to revert those permissions, since I am not able to login using putty, so how Can I change the permission of this directory. I am not able to do this using FileZilla also. – Soft Kaka – 2019-01-15T07:53:43.993
@AndroidDev Check the comments, Magnus' comment dated Aug 18 '17 at 13:31 helped me. – Amol Chakane – 2019-01-15T11:18:02.760