[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sshd from /etc/rc5.d



A long time ago, in a galaxy far, far way, someone said...

>     I recently installed openssh onto a debian box and the documentation
> says that it is normally run from /etc/rc, it seems that /etc/rc5.d is the
> comparable place in Debian to run it from. However, I created the sym link
> to the sshd file located elsewhere in the /etc/rc5.d directory. I cannot get
> sshd to start, I end up having to do it from the command line. Below is what
> the sym link looks like.
> 
> lrwxrwxrwx   1 root     root           32 Nov 22 09:48 S99sshd ->
> /usr/local/openssh-1.2pre13/sshd
> 
> Also, I can run the sym link as root manually and it starts up okay.

You have the right idea, but you seem to be getting the *BSD way confused
with the Linux way - Linux has the concept of runlevels, while *BSD
doesn't, among other things.

One of the reason's why you can't seem to get it to start at boot time is
that you're probably using the wrong rc?.d directory - the default
runlevel for Debian is 2, rather than 5 (ie should have used
/etc/rc2.d).

Also, symlinking sshd to /etc/rc5.d/S99sshd isn't quite the right thing to
do - it would be best if you make a shell wrapper in /etc/init.d (I've
included the one I use so that you have a starting point).

-- 
----------------------------------------------------------------------
Phil Brutsche					pbrutsch@creighton.edu

"There are two things that are infinite; Human stupidity and the
universe. And I'm not sure about the universe." - Albert Einstein
#! /bin/sh
#
# skeleton	example file to build /etc/init.d/ scripts.
#		This file should be used to construct scripts for /etc/init.d.
#
#		Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#		Modified for Debian GNU/Linux
#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version:	@(#)skeleton  1.8  03-Mar-1998  miquels@cistron.nl
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/sbin/sshd
NAME=ssh
DESC="Secure Shell"

test -f $DAEMON || exit 0

set -e

case "$1" in
  start)
	echo -n "Starting $DESC: "
	start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
		--exec $DAEMON
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
#	start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
#		--exec $DAEMON
	kill -9 `cat /var/run/sshd2_22.pid`
	echo "$NAME."
	;;
  #reload)
	#
	#	If the daemon can reload its config files on the fly
	#	for example by sending it SIGHUP, do it here.
	#
	#	If the daemon responds to changes in its config file
	#	directly anyway, make this a do-nothing entry.
	#
	# echo "Reloading $DESC configuration files."
	# start-stop-daemon --stop --signal 1 --quiet --pidfile \
	#	/var/run/$NAME.pid --exec $DAEMON
  #;;
  restart|force-reload)
	#
	#	If the "reload" option is implemented, move the "force-reload"
	#	option to the "reload" entry above. If not, "force-reload" is
	#	just the same as "restart".
	#
	echo -n "Restarting $DESC: "
	start-stop-daemon --stop --quiet --pidfile \
		/var/run/$NAME.pid --exec $DAEMON
	sleep 1
	start-stop-daemon --start --quiet --pidfile \
		/var/run/$NAME.pid --exec $DAEMON
	echo "$NAME."
	;;
  *)
	N=/etc/init.d/$NAME
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0

Reply to: