How to Setup Password Authentication For AWS EC2 Instances

  1. Log in to the server using ssh client of your choice using the private key.

ssh -i your-key.pem username@(public-ip-address)

  1. Open the sshd_config file.

sudo vi /etc/ssh/sshd_config

  1. Find the line containing “PasswordAuthentication” parameter and change its value from “no” to “yes“

PasswordAuthentication yes

  1. Setup ec2 user password using the “passwd” command.

sudo passwd ubuntu

  1. Now, restart the “sshd” service using the following command.

sudo service sshd restart

  1. Now you can log out and log in using the password you set for the user. For example,

ssh ubuntu@35.162.225.240