AWS EC2 servers do not allow users to log in with passwords by default. To log in to the EC2 server, a key pair is required. While it is safer to allow only key pair-based authentication, sometimes you may be required to log in with a username and password.
If you attempt to log in without selecting a key pair an error message will be thrown at you:
No supported authentication methods available (server sent: publickey,gssapi-keyex,gssapi-with-mic)
In this article, we will see how to enable password based authentication for AWS EC2 Server.
Enable Password Authentication In AWS EC2 Server
Log in to the AWS EC2 server with your key pair and update
$ sudo vi /etc/ssh/sshd_config
Add the following line to the file:
$ sudo service sshd restart
This will allow users to log in by giving in a username and a password.
Now to log in as root, change the password of the
root user and specify a new password:
$ sudo passwd root
You are good to go. Log out and log in with