Erratic sshd start
Erratic sshd start
HI,
I have a Centos 7 (fully updated) running, but not 24/7.
When I boot the system, I generally log in to it (Putty ssh) from my desktop PC (Win7).
However, I am not always successful in doing so. Quite often the sshd service isn't running, even though I have set it to start at boot time.
I then need to use Webmin to start the ssh server. I am then able to log in.
At other times it will work as expected.
I have used:
chkconfig sshd on
systemctl enable sshd
however this behaviour does not change.
What am I missing?
Thanks,
Bill.
I have a Centos 7 (fully updated) running, but not 24/7.
When I boot the system, I generally log in to it (Putty ssh) from my desktop PC (Win7).
However, I am not always successful in doing so. Quite often the sshd service isn't running, even though I have set it to start at boot time.
I then need to use Webmin to start the ssh server. I am then able to log in.
At other times it will work as expected.
I have used:
chkconfig sshd on
systemctl enable sshd
however this behaviour does not change.
What am I missing?
Thanks,
Bill.
Re: Erratic sshd start
On CentOS 7 systemd is in use that starts services in parallel rather than in series (as was the previous case). On my systems I often find that the system appears to be up and running with a login prompt on the console but that ssh is not accessible immediately. It takes up to a minute for it to start and be listening. Are you sure you're waiting long enough?
If you are then you are going to have to go and read your logs. Look at the output from systemctl status sshd before you restart it.
If you are then you are going to have to go and read your logs. Look at the output from systemctl status sshd before you restart it.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: Erratic sshd start
Thanks Trevor, that could be it.
I am sometimes able to log in via ssh after a while (upto 10 mins).
I'll give it some more time. I have looked at log files but see nothing untoward.
However, your explanation of services starting in parallel tells me a lot.
Bill.
I am sometimes able to log in via ssh after a while (upto 10 mins).
I'll give it some more time. I have looked at log files but see nothing untoward.
However, your explanation of services starting in parallel tells me a lot.
Bill.
Re: Erratic sshd start
10 minutes sounds excessive.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: Erratic sshd start
Yesterday, after more than an hour, I still could not ssh to the server.
I have tried this with firewall on and off, no difference.
I have tried this with firewall on and off, no difference.
Re: Erratic sshd start
So, time to go read all your logs then and try to work out why.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: Erratic sshd start
Log files duly inspected in great detail.
All they revealed was "Deprecated option RSAAuthentication".
So I commented out the relevant entry for that in sshd_config.
I also set "UseDNS no".
So far so good.
All they revealed was "Deprecated option RSAAuthentication".
So I commented out the relevant entry for that in sshd_config.
I also set "UseDNS no".
So far so good.
Re: Erratic sshd start
I would expect a config file syntax error etc to lead to a completely unstartable sshd. I suspect it's more likely that your network takes a while to come ready and obtain an ip address and that sshd starts before it's complete and fails to bind.
Have you explicitly listed an ip address to bind to in the sshd config? If so then perhaps that might be the cause - if it's told to listen on any interface/ip address then it will do so and will bind to e.g. localhost at startup. If you specify an ip address to listen on that's on an interface that takes a while to become ready (STP?) and sshd starts before the network interface has that ip then it will fail.
Have you explicitly listed an ip address to bind to in the sshd config? If so then perhaps that might be the cause - if it's told to listen on any interface/ip address then it will do so and will bind to e.g. localhost at startup. If you specify an ip address to listen on that's on an interface that takes a while to become ready (STP?) and sshd starts before the network interface has that ip then it will fail.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: Erratic sshd start
Seems the problem is solved - I disabled sshd.socket.
Re: Erratic sshd start
Eh? The fundamental part of the sshd process (listen for connections) is the problem? Suspect not. Suspect there's other things lurking beneath. Making a listening socket is the root problem. Hmmmm.