SSH Public Key aunthentication Exception " Key exchange failed: Expected SSH_MSG_KEX_GEX_GROUP [id=3] [Unknown"

SSH Public Key aunthentication Exception " Key exchange failed: Expected SSH_MSG_KEX_GEX_GROUP [id=3] [Unknown"

Exception 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)


Solution:

See the kexAlorithms (highlighted one) in the exception trace and add it in sshd_config file

Steps:

Add the below two lines in sshd_config file (/etc/ssh) and restart the ssh server.

HostKeyAlgorithms ssh-dss,ssh-rsa 
KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1