- Newest
- Most votes
- Most comments
It's not clear whether you still have this issue - your comment starts with still getting error but you've accepted @Mina Gobrial's answer.
The line debug1: No more authentication methods to try.
in the ssh -v output shows that password authentication is never being tried, because its not a valid authentication method.
If the problem isn't resolved then I'd like to throw this in - which flavour of Linux is the EC2 running? As well as making the changes to /etc/ssh/sshd_config the entries may also be present in files under /etc/ssh/sshd_config.d/ and the same changes would need to be made to these.
See the accepted answer to https://repost.aws/questions/QUE9_NBn5MQ5KgpjVyyy3ISA/unable-to-login-with-username-and-password-in-redhat-machine-created-in-aws where PasswordAuthentication
is present in /etc/ssh/sshd_config.d/50-cloud-init.conf on and instance provisioned with a Red Hat Linux AMI.
This error you are getting could be due to several reasons, and you need to check the following steps:
- Verify no syntax errors in sshd_config. An unrecognized option or a typo could cause the SSH service to revert to default settings or ignore misconfigured directives.
- Confirm the SSH service restarted correctly without errors.
- Check for SELinux or firewall restrictions. Use sestatus to see SELinux status and setenforce 0 for testing (reset with setenforce 1 after). Additionally, ensure your firewall settings do not block the SSH service or specific SSH configurations.
- Check permissions and ownership of SSH configuration files. sshd_config should be owned by root with 644 permissions.
- Make sure there's no AllowUsers or DenyUsers directive in sshd_config blocking access.
- Use ssh -vvv user@host for detailed error messages and check server logs in /var/log/auth.log or /var/log/secure for clues.
If this response has addressed your question, could you kindly accept the answer? It would greatly benefit the community. Thank you!
still getting error I've checked the sshd_config ,the SG and set SELinux to permissive mode for the ec2 also I've created another account sshuser with another password still get the same error
sudo service sshd restart ; echo $? returned 0 which means ssh service restarted succesfuly -----------OUTPUT OF ssh -vvv sshuser@x.x.x.x:------------------ debug1: Trying private key: C:\Users\akrou/.ssh/id_ed25519 debug3: no such identity: C:\Users\akrou/.ssh/id_ed25519: No such file or directory debug1: Trying private key: C:\Users\akrou/.ssh/id_ed25519_sk debug3: no such identity: C:\Users\akrou/.ssh/id_ed25519_sk: No such file or directory debug1: Trying private key: C:\Users\akrou/.ssh/id_xmss debug3: no such identity: C:\Users\akrou/.ssh/id_xmss: No such file or directory debug2: we did not send a packet, disable method debug1: No more authentication methods to try. sshuser@x.x.x.x: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
------------OUTPUT /var/log/secure:-------------------------- Mar 26 13:10:06 ip-172-31-43-104 sshd[14705]: Connection reset by invalid user sshuser x.x.x.x port 59174 [preauth]
---------------OUPUT /etc/cloud/cloud.cfg--------------------- disable_root:false mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service,_netdev', '0', '2'] resize_rootfs_tmp: /dev ssh_pwauth: true
Relevant content
- asked 6 months ago
- Accepted Answerasked 2 years ago
- asked 3 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
You're absolutely correct. I've made the necessary changes following your suggestion, and now everything is working smoothly. Thank you for pointing out the specific details, and I apologize for any confusion caused by my oversight.