If you are unable to login to cpanel server using ssh, the following script resets the SSH service configuration to the default one.
Substitute the server IP where required and take this in the web browser.
http://your_server_ip:2086/scripts2/doautofixer?autofix=safesshrestart
You will be able to login using SSH now