Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying my experience with Amazon EC2, but unable to connect to the server. After creating PEM file inside Amazon Management Console, then I create private key using PuttyGen. Using Putty, I tried to connect using newly created private key.

But it prompt me login as: and I entered "root". Then it gave me error "PLEASE EC2 login as EC2 user other than root"

Any idea which user is the error referring to -- since I don't see any user creation page at AWS management console?

Thanks

share|improve this question

5 Answers 5

up vote 4 down vote accepted

The "root" account has been disabled. Where you entered "root" before, enter "ec2-user" instead and you'll be in. Once you're in, if you need to run a command as root, put "sudo" in front of the command.

eg:

sudo nc -l 80

or to get a console as root:

sudo bash
share|improve this answer
    
hi Jim, i have same issue using MacBook while trying to connect using ssh, and it is resolved by changing root to ec2-user.. thanks! –  iwan Aug 30 '11 at 8:57

If you want to be able to login as root into a prebuilt Amazon AMI, you need to do two things, these commands should be run as root.

  1. Edit the /etc/ssh/sshd_config file and change the line that says 'PermitRootLogin No' to 'PermitRootLogin without-password'. Then restart the sshd client with 'service sshd restart'. Be careful, if you screw up the sshd file, it is possible you will only have your current ssh session to fix it, so always test any changes with a second session.

  2. Edit the /root/.ssh/authorized_keys file. The first (and only) entry starts with 'command ... sleep 10; ssh-rsa [big long key]'. If you remove the text from the beginning of the line until where it says ssh-rsa, you will be able to login as root via SSH with your Amazon keypair.

share|improve this answer
    
I discovered that is is essential to enable root login on instance storage instances as there is no way to fix anything if one is locked out! Worst - I once messed my sudoers file and had to terminate the instance. stackoverflow.com/a/4336527/482176 is a good answer too. –  Lord Loh. Apr 11 '12 at 19:06

Just insert ec2-user in the data section of your putty configuration.

share|improve this answer
    
hi Juan.. thanks for sharing your thought.. but it did not work. –  iwan Nov 28 '10 at 15:24

It sounds like that's something specific to the AMI you're loading your EC2 instance from. Most AMI's use root as the default user setup but that is dependent on how the AMI instance. In most cases this is simply root and it leaves you to create any additional users. I for instance have root installed in the AMI and have the SSH key installed on boot-up and then allow other users to be configured via Puppet. If you built your AMI with SSH configured to disallow root login then you would obviously need an alternative user to be setup so you could log in successfully.

share|improve this answer
    
hi Jeremy.. i tried to create another AMI, but still having the same problem.. –  iwan Nov 28 '10 at 15:25
    
Then i finally solve it by using cygwin-ssh , i think it's a problem with my putty.. because it should not prompt with any login if it read the private key correctly.. i still don't know where the fault is –  iwan Nov 28 '10 at 15:26

I noticed the solution to this problem was in putty, where you put your long connection name like:

ec2-50-11-111-111.compute-1.amazonaws.com

you can use

ubuntu@ec2-50-11-111-111.compute-1.amazonaws.com

and that error goes away and you are logged in as whatever username you put in front of the @ sign

share|improve this answer

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.