[CentOS] C7.4 and sshd restart problem [SOLVED]

Tue Nov 7 12:52:44 UTC 2017
Alessandro Baggi <alessandro.baggi at gmail.com>

Hi list,
I solved the problem. Anyone had answered but I report the solution for
similar problem.

The problem was caused by an sshd.service under /etc/systemd/system/.
This file was placed because upgrading from 7.2 to 7.3 I got problem with
ssh startup and someone suggested to add pidfile directive in sshd.service
to solve the problem. Updating from 7.3 to 7.4 I think that 2 files for
sshd caused some conflict that kill my sshd. Removing the first file
problem is solved.

Thanks to all.

Il 06 Nov 2017 9:03 PM, "Alessandro Baggi" <alessandro.baggi at gmail.com> ha
scritto:

Hi list,
Some days ago I updated my centos 7.3 to 7.4 on a dell server. After this
update I noticed a strange behaviour by sshd. I noticed this problem
because trying to connect to ssh I got connection refused or high latency
between connecting and password req.

So I noticed that sshd will be restarted every ~2 min.

>From log I get this:

Received signal 15; terminating
Failed to start OpenSSH server daemon
Unit sshd.service entered failed state
sshd.service failed
sshd.service holdoff time over, scheduling restart
....and sshd restart.

This happens so fast that if I run systemctl status I can't get the failed
status.

Logs does not help also in debug facility. There is not any cronjob that
kill sshd.
I tried also to change some basic sshd_config directives and when running
systemctl restart sshd it hangs until I type crtl-C and from log I see that
sshd is restarted.

In sshd_config there aren't errors and the config is the same since 2016.
On another machine in the same network I have the same configuration and
same software installed (replica with native c7.4) but the problem does not
occurs.
I checked also md5 of relative server /usr/sbin/sshd and they match.

Selinux is disabled and using non standard port.

I notices also that if I'm connected to sshd and sshd crashes/restart my
current session is not killed.

I have not stopped and restarted sshd because this is a dedicated server
and until my provider does not attach a kvm switch I can't do other tests.
I will try also to stop sshd and run from console using debug hoping that
helps.

What I can check to know the reason of this behaviour? This is sshd problem
or other?

Thanks in advance.