Wednesday, June 15, 2011

Resetting SSH port to 22 via WHM

If you are unable to connect to a cPanel server over SSH:

* because of a forgotten custom SSH port
* having restarted sshd service after making any wrong settings in sshd_config file

- you can still connect to that server via safe sshd service provided by cPanel over port 22 by following the steps below:

* Log in to WHM as root user and browse to the following URL.

http://x.x.x.x:2086/scripts2/autofixer (Replace x.x.x.x with the server IP address)

* You will be presented with an AutoFixer window. Enter
*"safesshrestart"* in the given text field (Enter script name) and click Submit.

It will kill any already running sshd processes and start a new one listening on the default 22 port using the configuration file at /var/cpanel/safe_sshd.

* Connect to the server over SSH via port 22.

* Note down the custom port set in /etc/ssh/sshd_config or fix any errors in it. Once you are ready, restart sshd.

* You should then be able to connect to the regular ssh service running on your custom port if set any.

You can find more information regarding autofixer feature at http://httpupdate.cpanel.net/autofixer/

No comments:


View My Stats