Login Amazon EC2 as root using authorization keys
Published in
1 min readMar 21, 2020
Follow the steps below.
- Login to your EC2
- Type “sudo su”
- use nano or vim to open the file /root/.ssh/authorized_keys
- comment or remove the line below
#no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command=”echo ‘Please login as the user \”centos\” rather than the user \”root\”.’;echo;sleep 10"
- restart openssh service by “service sshd restart”
- Logout from ssh
- ReLogin again using root