By default when you create a new instance in AWS, you have to authenticate via the PEM files. This is the most secured way to connect to the instance. But sometimes you need to login using password based authentication. Here I have shown how you can change the Authentication process. To continue, you need to first create an EC2 instance.
Then open the sshd config file for editing using VIM.
sudo vi /etc/ssh/sshd_config
Then find this keyword: PasswordAuthentication
It’s default value is no, so to enable password based authentication you need to set that to YES.
then run the following command to restart the SSH server.
sudo service sshd restart
In conclusion, PEM file based authentication is a very secured way of login. But sometimes you need to turn on Password based authentication, which is shown in this article.