How to enable root ssh login in EC2

AWS doesn't grant root access by default to EC2 instances as a security measure. All users are supposed to open a ssh connection using the secure key-pair to login as normal users. But some applications required remote root access for the proper functioning.

Please note that AWS doesn't recommend to enable direct root access to EC2 and enable it your own risk.

This article explains the steps to enable root ssh login in EC2 instance.

Step1: Login to EC2 instance and switch to root user using sudo command

Step2: Uncomment the following lines in the ssh configuration file /etc/ssh/sshd_conf

PermitRootLogin yes
PasswordAuthentication yes

Step2: Reload ssh service

#service sshd reload

Step3: Set password for root

#passwd

Note: If you require passwordless authetication for root, need to set up the appropriate ssh key file for root.

Step4: Update the AWS Cloud configuration file /etc/cloud/cloud.cfg with the following line.

disable_root false

That's all………

Leave a Reply

Your email address will not be published. Required fields are marked *