Troubleshooting SSH Public Key authentication Exception: Key exchange failure

Troubleshooting SSH Public Key authentication Exception: Key exchange failure

When executing the SSH troubleshoot script in your server, if you encounter an exception as shown below, follow the steps given to troubleshoot the error:

Sample Trace
com.adventnet.appmanager.server.hostresources.util.PublicKeyConnect.main(PublicKeyConnect.java:83) 
Caused by: com.maverick.ssh.SshException: Key exchange failed: Expected SSH_MSG_KEX_GEX_GROUP [id=3] [Unknown cause] 
at com.maverick.ssh.components.jce.client.DiffieHellmanGroupExchangeSha1.performClientExchange(DiffieHellmanGroupExchangeSha1.java:223)

Steps:

1. Add the below two lines in sshd_config file present in the /etc/ssh directory.
HostKeyAlgorithms ssh-dss,ssh-rsa 
KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1 
2. Restart the SSH server.

                  New to ADSelfService Plus?