1

When I reboot my Linux server (BusyBox Linux) all ongoing ssh client connections run into a stucked state until a timeout on client side occurs. There is no message sent to the ssh client to produce a "Disconnect" error message. This basically makes the ssh client appear like something is frozen.

I'am using systemd with this service config for sshd in version OpenSSH_5.8p2

[Unit]
Description=SSH Per-Connection Server
After=syslog.target

[Service]
ExecStart=/usr/sbin/sshd -i
SuccessExitStatus=0 255
StandardInput=socket

Is there a way to configure a gracefull shutdown for the sshd?

2

sshd sessions on my (rhel) server may be identified by:

~# ps -ef |grep sshd:
root     12120     1  0 10:18 ?        00:00:00 sshd: sysope [priv]
sysope   12132 12120  0 10:18 ?        00:00:00 sshd: sysope@pts/2

killing those processes will immediately close the connections. So adapt your sshd service file for systemd like this:

[Unit]
Description=SSH Per-Connection Server
After=syslog.target

[Service]
ExecStart=/usr/sbin/sshd -i
ExecStop=/usr/sbin/killall -9 sshd
SuccessExitStatus=0 255
StandardInput=socket
  • this answer helped me to find the solution i added ExecStop=/usr/sbin/killall -9 sshd to my ssh service config above. Then the ssh client get an Disconnect – Oliver G. Oct 9 '14 at 7:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.