0

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@10.250.32.240
Permission denied (publickey).

I am on redhat

cat /etc/*release
NAME="Amazon Linux AMI"
VERSION="2018.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2018.03"
PRETTY_NAME="Amazon Linux AMI 2018.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2018.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
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.

0

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.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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