I'm trying to setup a second sshd daemon (with different configuration and port listening), but have a problem with the PID file. Apparently the start-stop-daemon ignores the --pidfile $PID directive. When I start the second sshd daemon (the /etc/init.d script attached), the original /var/run/sshd.pid is overwritten instead of the new /var/run/sshd-1.pid created. As a result there are of course problems when stopping any of the two daemons. Otherwise, it works fine.
-Igor Mozetic #! /bin/sh # /etc/init.d/ssh-1: start and stop the OpenBSD "secure shell(tm)" daemon # Configurable options: DIR="/var/run/sshd-1" PID="/var/run/sshd-1.pid" CFG="-f /etc/ssh/sshd_config-1" test -x /usr/sbin/sshd || exit 0 ( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0 # forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists if [ -e /etc/ssh/sshd_not_to_be_run ]; then echo "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)" exit 0 fi check_config() { /usr/sbin/sshd -t $CFG || exit 1 } case "$1" in start) test -f /etc/ssh/sshd_not_to_be_run && exit 0 #Create the PrivSep empty dir if necessary if [ ! -d $DIR ]; then mkdir $DIR ; chmod 0755 $DIR fi echo -n "Starting ssh server: sshd-1" start-stop-daemon --start --quiet --pidfile $PID --exec /usr/sbin/sshd -- $CFG echo "." ;; stop) echo -n "Stopping ssh server: sshd-1" start-stop-daemon --stop --quiet --oknodo --pidfile $PID echo "." ;; reload|force-reload) test -f /etc/ssh/sshd_not_to_be_run && exit 0 check_config echo -n "Reloading ssh server's configuration" start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile $PID --exec /usr/sbin/sshd -- $CFG echo "." ;; restart) test -f /etc/ssh/sshd_not_to_be_run && exit 0 check_config echo -n "Restarting OpenBSD Secure Shell server: sshd" start-stop-daemon --stop --quiet --oknodo --pidfile $PID sleep 2 start-stop-daemon --start --quiet --pidfile $PID --exec /usr/sbin/sshd -- $CFG echo "." ;; *) echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}" exit 1 esac exit 0 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]