JMGarcía

Member
Oct 11, 2016
18
1
3
Spain
cPanel Access Level
Root Administrator
Hello,

In Service Status I see this:

Service Version Status

sshd clients-7.4p1-13 down

All my sites working fine but when tried restart SSH and get this:

Waiting for “sshd” to start ……Job for sshd.service failed because the control process exited with error code. See "systemctl status sshd.service" and "journalctl -xe" for details. …failed.

Cpanel::Exception::Services::StartError Service Status

Service Error
(XID u4kapn) The “sshd” service failed to start.

Startup Log
Feb 27 14:54:59 sv.domain.com systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Feb 27 14:54:59 sv.domain.com systemd[1]: Failed to start OpenSSH server daemon.
Feb 27 14:54:59 sv.domain.com systemd[1]: Unit sshd.service entered failed state.
Feb 27 14:54:59 sv.domain.com systemd[1]: sshd.service failed.

Log Messages
Feb 27 14:54:59 sv sshd[319]: fatal: Cannot bind any address.
Feb 27 14:54:59 sv sshd[319]: error: Bind to port 22 on :: failed: Address already in use.
Feb 27 14:54:59 sv sshd[319]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
Feb 27 14:54:32 sv sshd[32625]: fatal: Cannot bind any address.
Feb 27 14:54:32 sv sshd[32625]: error: Bind to port 22 on :: failed: Address already in use.

sshd has failed. Contact your system administrator if the service does not automagically recover.


Is this a critical issue? How can I fix this?

Thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,250
463
Feb 27 14:54:59 sv sshd[319]: fatal: Cannot bind any address.
Feb 27 14:54:59 sv sshd[319]: error: Bind to port 22 on :: failed: Address already in use.
Feb 27 14:54:59 sv sshd[319]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
Feb 27 14:54:32 sv sshd[32625]: fatal: Cannot bind any address.
Feb 27 14:54:32 sv sshd[32625]: error: Bind to port 22 on :: failed: Address already in use.
Hello,

This suggests another service is already running on port 22. You can run the following command to see which process is utilizing the port:

Code:
netstat -tulpn | grep :22
Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,250
463
Hello,

In this case, it looks like SSH is in-fact running on port 22. Here's a response from one of our Technical Analysts on a similar issue opened via a support ticket. Check to see if this helps to solve the issue on your system:

The issue here is SSHD appears to be running as something of a "rogue" process. It looks like earlier today the SSHD process was forcefully killed with a KILL9 signal which could've come from a number of sources, and when SSHD was restarted after this it wasn't properly "registered. The process ID of SSHD wasn't recorded in systemd, and it wasn't marked as having been successfully restarted. Since systemd still thinks SSHD is down, it attempts to restart the service which then fails when it can't connect to port 22 because the "rogue" SSHD process is already using port 22:
You may also be able to try using out "safesshrestart" script which attempts to forcefully kill any existing SSH processes, and then restarting the SSHD server from WHM.

To use the safesshrestart autofixer script you will need to log into your WHM and navigate to the following URL:

=====
https://$hostname-or-ip-address:2087/cpsess##########/scripts2/autofixer
=====

Replacing "$hostname-or-ip-address" with the correct URL information, and "cpsess#" with the current cpsess value in your URL bar. On the page this resolves to you will enter 'safesshrestart' and Submit. Once this is complete you will need to navigate to WHM > Restart Services > SSH Server (OpenSSH) and restart the SSH service. This should clear up the SSH process issues.
Thank you.
 

JMGarcía

Member
Oct 11, 2016
18
1
3
Spain
cPanel Access Level
Root Administrator
Hello,

AutoFixer Execution
Requesting script ...

Done.


Executing script ...


Attempting to locate sshd binaries installed on the system ...<br />
Located /usr/sbin/sshd<br />
Done.<br />
Killing exisiting sshd processes...<br />
killed 32597 Done.<br />
configuring sshd to run on port 22<br />
Could not load host key: /etc/ssh/ssh_host_dsa_key
/usr/sbin/sshd successfully started!<br />
root 26161 0.0 0.0 104508 1372 ? Ss 21:47 0:00 /usr/sbin/sshd -f /var/cpanel/safe_sshd
<br />


Done.

But still issue,... Service Version Status SSh down and if restart error,...
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,250
463
Hello,

Could you open a support ticket using the link in my signature so we can take a closer look?

Thank you.