Please Note this article is only for information and practice. Please don't do this until you have any specific and valid reason. Because it's a big security hole by opening direct root access of server in the cloud.
Enable log in as a root user on AWS:
I have an ubuntu server so I will take an example of Ubuntu.
Login to your server with ubuntu user and then switch to root user using the sudo command.
login as: ubuntu
ubuntu@ip: sudo su -
|
Now edit /root/.ssh/authorized_keys file. You will get a more extra code with your key.
# vim /root/.ssh/authorized_keys
|
Save it and tries to log in as a root user.
You will be successfully logged in to the server as a root user directly.
How to revert
If you want to revert this and disable root login so just insert below code into /root/.ssh/authorized_keys file before your key.
no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"ubuntu\" rather than the user \"root\".';echo;sleep 10"
|