Can't SSH as root into EC2 server - Please login as the user "ubuntu" rather than the user "root"

Jamie Hutber picture Jamie Hutber · Mar 30, 2013 · Viewed 38.9k times · Source

I am trying to SSH into my server via WinSCP, although the problem will occur with putty as well.

I have Ubuntu 12.04 I have edited /etc/ssh/sshd_config and added PermitRootLogin without-password to the bottom of the file. But this still doesn't seem to have changed my problem.

People have mentioned needed to restart ssh demon. I have tried:

 /etc/init.d/sshd reload
 reload sshd.service
 /etc/init.d/sshd reload

All of the above are unrecognised.

I have then tried Files ¬ Custom Commands ¬ sudo -s & su No luck there either.

Answer

nneonneo picture nneonneo · Mar 30, 2013

http://alestic.com/2009/04/ubuntu-ec2-sudo-ssh-rsync describes all the options available to you, and includes instructions for enabling SSH to root on EC2:

ssh -i KEYPAIR.pem ubuntu@HOSTNAME   'sudo cp /home/ubuntu/.ssh/authorized_keys /root/.ssh/'