On Sat, 2 Sep 2000, MICHAEL SUN wrote:
> after I check sshd.init file, I found:
> you use 'daemon' function to start sshd.
> 
> but 'daemon' will not start a daemon if the daemon process already
> exist, isn't it right?
Yes.  This has existed at least from OpenSSH 2.0 (as long as I have been
using it).
Starting sshd fails because incoming ssh connections are registered as the
same sshd daemon processes as the one being started.  This happens in
daemon() in /etc/rc.d/init.d/functions.  The culprit is:
---
       [ -n "$pid" ] && return
---
where $pid is the number of incoming sshd connections plus one if running
sshd server at the moment.
The following is not probably not the clean solution, but I don't think
daemon keyword _can_ be used with sshd. :-/
-----
--- sshd.orig   Sat Sep  2 12:56:47 2000
+++ sshd        Sun Sep  3 11:06:03 2000
@@ -57,9 +57,9 @@
 
                echo -n "Starting sshd: "
                if [ ! -f $PID_FILE ] ; then
-                       daemon sshd
+                       /usr/sbin/sshd
                        RETVAL=$?
-                       touch /var/lock/subsys/sshd
+                       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sshd
&& echo_success
                fi
                echo
                ;;
-----
-- 
Pekka Savola                    "Tell me of difficulties surmounted, 
Pekka.Savola at netcore.fi          not those you stumble over and fall"