AWS EC2 Instance Swap to Password Authentication

Although you should be using a keypair for SSH authentication (and not exposing to the Internet), if you’re working with a throw-away or test instance you might just need password authentication to be enabled. Here’s how!

Open the SSH configuration file.

vi /etc/ssh/sshd_config

Set the line “PasswordAuthentication” to “yes”. Save and close.

Restart the SSH daemon with:

systemctl restart sshd

Create a user:

useradd -s /bin/bash -d /home/bobsmith/ -m bobsmith
passwd bobsmith

Now you can login with username and password.

Leave a comment