Bug 18023 - '/etc/rc.d/init.d/sshd stop' doesn't stop all sshd processes, subsequent attempts to start ssh fail
Summary: '/etc/rc.d/init.d/sshd stop' doesn't stop all sshd processes, subsequent atte...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: openssh
Version: 7.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Nalin Dahyabhai
QA Contact:
URL:
Whiteboard:
: 18205 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-10-01 14:13 UTC by Adam Haile
Modified: 2008-05-01 15:37 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2000-11-18 02:30:22 UTC
Embargoed:


Attachments (Terms of Use)

Description Adam Haile 2000-10-01 14:13:32 UTC
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]#

Comment 1 Nalin Dahyabhai 2000-10-02 01:06:57 UTC
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.

Comment 2 Andy Nash 2000-10-03 17:43:05 UTC
*** Bug 18205 has been marked as a duplicate of this bug. ***

Comment 3 Andrew Bartlett 2000-11-18 02:30:19 UTC
Could this solution be the one required for bug 20696?

Comment 4 Nalin Dahyabhai 2001-04-03 00:04:03 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.