Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

We created an AWS micro instance running Ubuntu 10.04, and we can putty in as the "ubuntu" user using the key pair just fine. Now I've created two new users, but when I try to putty into the instance using their usernames I get "Server refused our key".

What's going on? Is the keypair tied to the ubuntu user? Also, do we have to create a keypair for these users, or can they log in using a password? Or do we need to always putty in as "ubuntu" and then "su - myusername"? Or am I just missing something simple?

share|improve this question

Yes the keypair is tied to the ubuntu user. After you create the new users, you'll need to put the key you want to use in $HOME/.ssh/authorized_keys .. Its a little complicated, as you also need to make sure the $HOME/.ssh has secure permissions

chmod 0700 $HOME/.ssh

and that the authorized_keys file also has secure permissions

chmod 0600 $HOME/.ssh/authorized_keys

One trick is to just copy the ubuntu user's key file to the new users if you just want to use the same key.

sudo cp -arf /home/ubuntu/.ssh /home/myuser/.ssh
chown -R myuser.myuser /home/myuser/.ssh

If you setup a password for those new users (not recommended actually.. password brute force attacks of SSH servers are rampant on the internet) you can also do this from your client machine:

ssh-copy-id user@host

Which will handle all of the permissions for you. Also if you store your key in your account, you can do

ssh-import-id your-launchpad-user

And it will pull your key from launchpad (this command was renamed to ssh-import-id in 11.04 and later).

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.