If you come across a situation such that you are unable to connect to a cPanel server over SSH:
1) because of a forgotten custom SSH port. ( Other than port 22)
2) restarted sshd service after making any wrong changes in sshd_config file
Don't get panic, follow the steps below:
Step1: Log in to WHM as root and browse to the following URL.
http://x.x.x.x:2086/scripts2/autofixer (Replace x.x.x.x with the server IP address)
Now, you will get into an AutoFixer window.
Enter "safesshrestart" in the given field and click Submit.
It will kill all running sshd processes and start a new one listening on the default 22 port using the configuration file at /var/cpanel/safe_sshd.
Now, connect to the server over SSH via port 22 and restart sshd service. You should now be able to connect to the regular ssh service running on your custom port if set any.
More information about autofixers can be found in http://httpupdate.cpanel.net/autofixer/