1

It seems from the EC2 documentation that one must logon with the specific userid associated with the AMI:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html

Use the ssh command to connect to the instance. You'll specify the private key (.pem) file and user_name@public_dns_name. For Amazon Linux, the user name is ec2-user. For RHEL5, the user name is either root or ec2-user. For Ubuntu, the user name is ubuntu. For Fedora, the user name is either fedora or ec2-user. For SUSE Linux, the user name is root. Otherwise, if ec2-user and root don't work, check with your AMI provider.

ssh -i my-key-pair.pem [email protected]

Now I have tried to logon with a different user - that was created via adduser:

adduser changsha

That user works on the system:

root@ip-10-151-25-94 ~]$ su - changsha
[changsha@ip-10-151-25-94 ~]$

However it is not (apparently) possible to logon to the AWS instance using that id. Notice: no "Enter Password" is returned. It just fails straightaway.

13:36:28/sparkup2 $ssh -i ~/.ssh/hwspark14.pem [email protected]
Permission denied (publickey).

The only thing working presently is to logon with root! So then - how do we manage multiple users on the cluster?

Update David's answer works: here is some additional info

https://forums.aws.amazon.com/message.jspa?messageID=138588

You should find an authorized_keys file (I'm using Ubuntu 12.04, this might change with other distros, I guess).
Let's check what it is:
$ cat ~/.ssh/authorized_keys
Outuput:
ssh-rsa SAGsg43 (....) sd53ySGS aws_machines

And that is the corresponding public key.

1 Answer 1

2

You need to create a .ssh directory under the home directory of the new user and copy your public key there. Make sure you also set the proper permissions for the authorized_keys file. Detailed instructions can be found here.

3
  • Thx for the pointer. I only have the private key foo.**pem** . AWS changed their handling of key pairs couple years back: where is the public key now? Commented Jun 23, 2015 at 21:00
  • You can copy it from the .ssh directory of the ec2-user if you want to use the same key. Otherwise you can generate a private/public key pair locally and use that instead. It doesn't have to come from AWS. Commented Jun 23, 2015 at 21:03
  • Got it : an old aws post gives more details : I am updating the OP. Commented Jun 23, 2015 at 21:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .