Running '/etc/rc.d/init.d/sshd stop' only stops the original sshd process, but not the processes spawned to handle connections. As a result, existing sshd connections aren't shut down. Also, trying to restart sshd fails, since the daemon() function of /etc/rc.d/init.d/functions sees that there are sshd processes running and refuses to start a new one. Annotated typescript: First, lets see what sshd processes are running ... [root@eliaha aah]# ps aux | grep sshd root 499 0.0 0.1 2460 200 ? S Sep30 0:03 /usr/sbin/sshd root 8080 0.4 1.1 3076 1444 ? S 09:56 0:00 /usr/sbin/sshd 499 is the original sshd process started at boot-up. 8080 was spawned to serve an ssh connection. Now let's try to stop sshd ... [root@eliaha aah]# /etc/rc.d/init.d/sshd stop Stopping sshd: [ OK ] Ok, the script in init.d *thinks* it stopped sshd, BUT ... [root@eliaha aah]# ps aux | grep sshd root 8080 0.1 1.1 3076 1444 ? S 09:56 0:00 /usr/sbin/sshd ... process 8080 is still there, meaning the ssh user is still connected. Now let's try and restart sshd ... [root@eliaha aah]# /etc/rc.d/init.d/sshd start Starting sshd: ... uh-oh, no [ OK ]. Did it start sshd? ... [root@eliaha aah]# ps aux | grep sshd root 8080 0.1 1.1 3076 1444 ? S 09:56 0:00 /usr/sbin/sshd No, only the old sshd user process is running. When init.d/sshd called daemon() (from init.d/functions), daemon() noticed that there already was a process named sshd and refused to start a new one. But, since this process is serving a user, there isn't any process listening for new connections. This means that ... [root@eliaha aah]# ssh aah@localhost Secure connection to eliaha.duke.edu refused. ssh services are down and can't be restarted until whatever user had established the ssh process 8080 decides to quit (or the sysadmin manually kills 8080). Thanks for your work. Yours, Adam Haile adam.haile --- Additional information, in case it proves useful: [root@eliaha /root]# uname -a Linux eliaha.duke.edu 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 2000 i686 unknown [root@eliaha /root]# cat /etc/issue Red Hat Linux release 7.0 (Guinness) Kernel 2.2.16-22 on an i686 [root@eliaha /root]# rpm -q openssh openssh-2.1.1p4-1 [root@eliaha /root]# rpm -q openssh-server openssh-server-2.1.1p4-1 [root@eliaha /root]#
The init script has now been tweaked to start the server correctly when connections are open. Shutting down the server should not terminate open connections, otherwise remotely restarting sshd would be disruptive. A bug-fix errata will go out to fix this.
*** Bug 18205 has been marked as a duplicate of this bug. ***
Could this solution be the one required for bug 20696?
A work-around for startup problems is in-place in the 2.5.2p2-1.7.2 errata, with the correct fix in the initscripts package in Raw Hide.