Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 am able to ssh into an ec2 instance as the root user using the private key .pem that was generated when I created the instance.

$ ssh -i Desktop/key.pem

I then created a new user

$ useradd dummy

When I run the following command to sign in as the dummy user

$ ssh -i Desktop/key.pem

I get the following error

Permission denied

How do I ssh into the new instance as the dummy user?

share|improve this question
up vote 2 down vote accepted

As Roman points out, you need to copy the public part of your key (usually ending .pub) to this file: /home/dummy/.ssh/authorized_keys:


Note, youll probably have to create the .ssh folder in /home/dummy first.

Then make sure the authorized_keys file has the correct permissions:

chmod 600 /home/dummy/.ssh/authorized_keys

Also, just to be safe, set the Selinux context too:

restorecon /home/dummy/.ssh/authorized_keys
share|improve this answer
I am still getting the same error. I followed your instructions exactly. EDIT Setting the permissions to 700 on .ssh on the remote server resolved it. – user784637 Jul 8 '13 at 21:12
Had the exact same problem today, restorecon saved me. Thanks! – Wiesław Herr Jan 30 '15 at 13:20

You need to add your generated key to the newly created user's authorized_keys.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.