Login Amazon EC2 as root using authorization keys

Ehsanul Hoque
The Devs Tech
Published in
1 min readMar 21, 2020
Photo by Vania Shows on Unsplash

Follow the steps below.

  1. Login to your EC2
  2. Type “sudo su”
  3. use nano or vim to open the file /root/.ssh/authorized_keys
  4. 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"
  1. restart openssh service by “service sshd restart”
  2. Logout from ssh
  3. ReLogin again using root

--

--

Ehsanul Hoque
The Devs Tech

Alhamdulillah Worker, Developer, বড়ছেলে, Brother. That’s It.