Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Linux AMI setup on EC2. The default user is ec2-user. I created a second user account on the instance. I copied the .ssh/authorized_keys file from ec2-user home directory to the new user's home directory. Set the privs on .ssh/ to 700 and on authorized_keys to 600. Executed 'chown' to set owner of the .ssh/ folder as the new user. But when I log in as the new user, I get a 'Permission denied (publickey).' message. Here is what I see when I run ssh -v -i:

debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: testami-key.pem
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

How do I fix this? Thanks.

share|improve this question

migrated from Jan 9 '13 at 1:56

This question came from our site for professional and enthusiast programmers.

What's the log file on the server saying? /var/log/secure – Michel Feldheim Jan 8 '13 at 23:23
Did you generate a private key, etc... per – user1884047 Jan 8 '13 at 23:24
up vote 2 down vote accepted

Did you also chown the authorized_keys file to the new user name? You only mentioned chowning the .ssh directory.

share|improve this answer
Thank you! Thank you! Was struggling with this for several hours. Will accept answer when SO limitation expires. – sotn Jan 8 '13 at 23:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.