Ubuntu on EC2 creates a user ubuntu by default. I can set up SSH keys with PuTTY and login in just fine. I've created two more logins but cannot use same PuTTY configuration to get in. I've dug around quite a bit and changed /etc/ssh/ssh_config files and restarted but it doesn't seem to help. I'm guessing anyone else using AWS image may have encountered this same scenario. Thanks, Craig this is ubuntu 3.13.0-48-generic


There isn't any special ssh elastic cloud compute sauce! Rather, each newly created user needs a separate ssh directory and authorized key file.

First, from you EC2 server, switch to your newly create user account ('foo' in this example):

    su foo

Next, create an SSH directory for foo and set permissions:

    mkdir .ssh  && chmod 700 .ssh

Then change into the newly created directory:

    cd .ssh/

Here's a refresher on generating a private/public key pair on your local machine:


Once you have your id_rsa.pub key, you can cat and then copy the key from your local machine to your server:

    echo “paste your_key_here" > ~/.ssh/authorized_keys

Set permissions on the contents of the directory:

    chmod 600 ~/.ssh/*

It's not a bad idea to edit the SSH config file as a root user (with vi or your text editor of choice):

sudo vi /etc/ssh/sshd_config 

and add the users ubuntu foo (and any additional users you've created) to the AllowedUsers Field (you may need to create it if it isn't there):

    AllowUsers ubuntu foo

(write & quit).

Lastly, restart the service:

    service ssh restart 

Test & confirm that you can now log in as user foo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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