I set up the following steps to connect to ssh on aws ec2 ubuntu with a password rather than a pem key.
- Create a new user
- Grant superuser privileges in /etc/sudoers
- Change “PasswordAuthentication” to “yes” through “/etc/ssh/sshd_config”
- Restart ssh with sudo systemctl restart ssh
However, if you still connect via ssh, the following message appears.
” ubuntu@[myserverIP]: Permission denied (publickey). “
I tried all the methods that came up through Googling, including checking AWS inbound rules and resetting with ssh-keygen -R.
The following is the server connection log.
2024-05-16T15:30:12.605815+00:00 ip-172-31-46-115 sshd[1777]: Connection closed by authenticating user ubuntu 124.50.247.56 port 49835 [preauth]
Connection via pemkey still works fine.
I don’t know what the problem is.
If you need any logs, please ask for them.
Enter : ssh username@serverIP
result : ubuntu@[myserverIP]: Permission denied (publickey)
It does not proceed to entering the password.
ji won is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.