Discussion:
sshd refuses connections until I restart the daemon
(too old to reply)
Patrick McMunn
2018-05-09 23:01:17 UTC
Permalink
I sometimes access my FreeBSD 11.1-RELEASE-p9 box from my laptop via ssh.
Sometimes I can connect, but sometimes I get the message "ssh: connect to
host 192.168.0.71 port 22: Connection refused". But if I walk over to the
computer and manually restart the sshd daemon, I can then go back to my
laptop and successfully ssh into the FreeBSD box. Why would it stop
accepting ssh connections until restarting the daemon, and how can I fix
this from recurring?
--
Patrick McMunn
thor
2018-05-10 00:42:41 UTC
Permalink
Well, as I understand, there are 2 things:

1) The existing ssh daemon stops responding for unknown reasons while
still running,

2) There is a mechanism to start daemons via inetd, and there are sshd
lines commented out in it's config.

So you could try (I didn't try so the recommendation is purely
theoretical) uncomment sshd in /etc/inetd.conf, comment out
sshd_enable='YES" in /etc/rc.conf, add inetd_enable="YES" in
/etc/rc.conf (if not added) and reboot. It should create a new instance
of sshd every time you access the computer. Hopefully the new instance
would work.
Post by Patrick McMunn
I sometimes access my FreeBSD 11.1-RELEASE-p9 box from my laptop via ssh.
Sometimes I can connect, but sometimes I get the message "ssh: connect to
host 192.168.0.71 port 22: Connection refused". But if I walk over to the
computer and manually restart the sshd daemon, I can then go back to my
laptop and successfully ssh into the FreeBSD box. Why would it stop
accepting ssh connections until restarting the daemon, and how can I fix
this from recurring?
Bruce Ferrell
2018-05-10 00:57:03 UTC
Permalink
Post by Patrick McMunn
I sometimes access my FreeBSD 11.1-RELEASE-p9 box from my laptop via ssh.
Sometimes I can connect, but sometimes I get the message "ssh: connect to
host 192.168.0.71 port 22: Connection refused". But if I walk over to the
computer and manually restart the sshd daemon, I can then go back to my
laptop and successfully ssh into the FreeBSD box. Why would it stop
accepting ssh connections until restarting the daemon, and how can I fix
this from recurring?
Patrick,

There are a couple of entries that could be in sshd_config that might create this effect:

MaxSessions: 10 is default; other values do interesting things

MaxStartups:  default is 10:30:100; see the man page for sshd_config as it get's a wee touch detailed

Regards
Matthias Apitz
2018-05-10 08:00:51 UTC
Permalink
On Thursday, 10 May 2018 01:01:17 CEST, Patrick McMunn
Post by Patrick McMunn
I sometimes access my FreeBSD 11.1-RELEASE-p9 box from my laptop via ssh.
Sometimes I can connect, but sometimes I get the message "ssh: connect to
host 192.168.0.71 port 22: Connection refused". But if I walk over to the
computer and manually restart the sshd daemon, I can then go back to my
laptop and successfully ssh into the FreeBSD box. Why would it stop
accepting ssh connections until restarting the daemon, and how can I fix
this from recurring?
What's written in /var/log/messages about sshd?
--
Sent from my Ubuntu phone
http://www.unixarea.de/
Loading...