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?



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.


sudo nc -l 80

or to get a console as root:

sudo bash
  • 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.

  • 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
  • Logging in as root is disabled as a security precaution. It is simple for ec2-user to gain root priviledges with sudo su on the command line. – jeffmcneill Jul 6 '17 at 13:06

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

  • 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.

  • 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:


you can use


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

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.