Sunday, November 13, 2022

How to access SSH of AWS EC2 Instance without keypair/pem file

  •  Login into your instance with the .pem file
  •  sudo su
  •  cd / (just incase)
  •  Edit, vim /etc/ssh/sshd_config and edit or do the equivilent of uncommenting these lines:

Port 22

PasswordAuthentication yes

PermitRootLogin yes

  • Restart sshd service, service sshd restart or systemctl restart sshd or equivilent
  • Set password, passwd
  • Log out and log back in without .pem file ssh root@12.345.67.890