Question
How can I safely restart my SSH service to temporarily reset the server's SSHD configuration to its default configuration?
Answer
cPanel provides an autofixer that stops the current SSH daemon and uses the -f option with the configuration file at /var/cpanel/safe_sshd . The script starts SSH using a default SSHD configuration and restarts the service on port 22 (if available).
Note: Please note, the script does not modify the existing SSHD configuration but allows you to try to gain access through the standard configuration.
To run the autofixer, log in to WHM at the following URL, replacing 203.0.113.2 with your server's IP address:
https://203.0.113.2:2087/scripts2/doautofixer?autofix=safesshrestart
Alternatively, you can run this command via SSH or from the WHM Terminal:
/scripts/autorepair safesshrestart
If you need to restore your server's SSHD configuration, restart SSH again either from the command line:
/scripts/restartsrv_sshd
You can restart SSH via the WHM menu Home / Restart Services / SSH Server (OpenSSH)