According to Amazon Linux AMI User Guide, root access is disabled by default for security reason.
How do I get root SSH access on my Amazon Linux AMI instance?
The Amazon Linux AMI does not allow remote root SSH by default. You should specify a key pair at instance launch and login as ec2-user using your key pair to access the command line. This user has sudo access by default to allow you to run root actions. If you want to enable remote root login, please be aware that it is significantly less secure than relying on key pairs and a secondary user.
You are strongly recommended to use sudo
to run root actions:
sudo yum upgrade
or getting root shell by running:
sudo -i
I understand the risk, what if I REALLY want it?
You can enable root access for SSH/SFTP if you want,
it’s especially useful when you want to overwrite some config files via SFTP.
Continue reading “Enable root access on Amazon EC2 Instance”