czwartek, 1 września 2011

Amazon EC2: Permission denied on SSH

I run into a problem with connecting to Amazon EC2 instance using RSA key. I've put my public key on the server in authorized_key's file but the remote server were denying my connection with:

Permission denied (publickey).

If you ever run into that kind of problem try to check your remote logs, everything became clear when I did that:

tail -f /var/log/secure
(...)
Authentication refused: bad ownership or modes for directory /home/----/.ssh

So, I simply changed .ssh directory permissions to 0700 and it start to work. Great!