Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

1 Answer 1

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 Launchpad.net 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
add comment

Your Answer

 
discard

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.