0 votes
1 view
in AWS by (19.2k points)

SSH to my AWS server just broke for both Putty and Filezilla. I'm making some effort for this post to be a comprehensive troubleshooting list, so if you share links to other stack overflow pages, I'll edit them into the question.

Disconnected : No supported authentication methods available (server sent :publickey)

The error is familiar from when I set up the connection almost a year ago. If you're setting up AWS SSH for the first time, these address the most common problems:

Wrong username: Disconnected: No supported authentication methods available (server sent: publickey)

Incorrect .ppk file: Unable to connect to amazon server using putty

However, the only thing I could think that would impact a previously working system is:

Wrong IP: Restarting an AWS instance (or creating an image) is not guaranteed to keep the same IP address. This would obviously have to be updated in putty.

What other possibilities are there?

The solution to this one (per the accepted post below) is that for AWS EC2 all 3 of these need to have proper permissions (777 not ok for any of these). Here's one example that works:

/home/ec2-user/ - 700

/home/ec2-user/.ssh/ - 600

/home/ec2-user/.ssh/authorized_keys - 600

/var/log/secure will tell you which one is throwing an error, consult this video tutorial to get access if you're completely locked out: http://d2930476l2fsmh.cloudfront.net/LostKeypairRecoveryOfLinuxInstance.mp4

1 Answer

0 votes
by (44.6k points)

For me, this error appeared immediately after I changed the user's home directory by

sudo usermod -d var/www/html username

It can also happen because of lack of proper permission to authorized_key file in ~/.ssh. Make sure the permission of this file is 0600 and permission of ~/.ssh is 700.

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...