Skip to Content

Authentication by ssh key failed

How to solve the error "Authentication by SSH key failed/Authentication by SSH key failed" in Ezeelogin?


Overview: This article helps in resolving the "Authentication by SSH key failed/Authentication by password failed" error that occurs in the backend(ezsh) when logging into a remote server.


Step 1: Confirm manually SSH to the remote server from the Ezeelogin gateway server. 

root@gateway:~# ssh user@remoteserver_ip or hostname

Step 2: Verify the password has been entered correctly from Ezeelogin GUI and backend(ezsh). Refer below screenshots.

Step 2(A): To view password from backend(ezsh), ssh into the jump server, select the server whose password needs to be viewed, and press the tab key.

Step 3: While adding the server using a key, make sure that the key is correct and does not contain any strange characters or space while copy-pasting.

Step 4: Check the error log of the remote server to which you are trying to login.

 For Ubuntu:

root@remote_server:~# /var/log/auth.log

 

For Centos:
root@remote_server:~# /var/log/secure

For other OS (RockyLinux, AlmaLinux, Amazon Linux, RHEL, Debian):

root@remote_server:~# journalctl -u sshd     or      journalctl -u ssh

Step 5: Ensure that either PasswordAuthentication or PublicKeyAuthentication directives is enabled in the sshd_config file on the remote server.

root@remote_server:~# sshd -T | grep -i 'PubkeyAuthentication\|PasswordAuthentication'

pubkeyauthentication yes
passwordauthentication yes

Step 6: Ensure that the user or user group is listed under AllowUsers or AllowGroups directives in the sshd_config file on the remote server to permit SSH access.

root@remote_server:~# sshd -T | grep -i 'AllowUsers\|AllowGroups'

allowusers root
allowusers alex
allowgroups ezuser

Step 7: Check the error logs 


Related Articles:

Error: Server login failed. Authentication by SSH key failed!. Remote Error: (1) if: Expression Syntax..

Authentication by key or password not supported