I have a very simple question, I have created an instance with aws AMI. I can log into it using my key. But I want to login using a username and password.

useradd username -p password

This has created the user and password, but when I try to login I get

ssh username@
Permission denied (publickey).

I am on redhat

cat /etc/*release
NAME="Amazon Linux AMI"
ID_LIKE="rhel fedora"
PRETTY_NAME="Amazon Linux AMI 2018.03"
Amazon Linux AMI release 2018.03

I did some reading and learnt it must be something to do with pam but I failed adding/removing anything.


Try this:

Modify /etc/sshd_config and set the PasswordAuthentication setting to yes.

Then restart sshd: /etc/init.d/sshd restart.

You'll either need to sudo to root, or use sudo to run these commands.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.