Next
Previous
Contents
Create a file called /etc/init.d/sshd Here is the contents:
#!/sbin/sh
#
# Start/Stop the Secure Shell Daemon - SSHD
#
# Written by Paul Gluhosky 11 May 1999
#
SSHD=/usr/local/sbin/sshd
IS_ON=/etc/chkconfig
if $IS_ON verbose; then
ECHO=echo
else
# For a quiet startup and shutdown
ECHO=:
fi
case "$1" in
'start')
if $IS_ON sshd; then
if test -x $SSHD; then
$ECHO "Starting sshd"
$SSHD > /dev/null 2>&1
$ECHO "."
fi
fi
;;
'stop')
if test -x $SSHD; then
$ECHO "Stopping sshd"
/sbin/killall $SSHD
$ECHO "."
fi
;;
*)
echo "usage: $0 {start|stop}"
;;
esac
Next create the following link:
ln -s /etc/init.d/sshd /etc/rc2.d/S95sshd
If you compile SSH by hand and don't use an RPM, you'll need to do this.
Create a file called /etc/rc.d/init.d/sshd Here is the contents:
#!/bin/sh
#
# chkconfig: 345 55 45
# description: sshd (secure shell daemon) is a server part of the ssh suite.
# Ssh can be used for remote login, remote file copying, TCP port
# forwarding etc. Ssh offers strong encryption and authentication.
#
# Source function library.
. /etc/rc.d/init.d/functions
# See how we were called.
case "$1" in
start)
echo -n "Starting sshd: "
if test -r /var/run/sshd.pid && kill -0 `cat /var/run/sshd.pid`
then echo "already running according to /var/run/sshd.pid. Not started."
else /usr/sbin/sshd
echo sshd
fi
touch /var/lock/subsys/sshd
;;
stop)
echo -n "Stopping sshd: "
[ -f /var/run/sshd.pid ] || exit 0
kill -TERM `cat /var/run/sshd.pid`
rm -f /var/run/sshd.pid
rm -f /var/lock/subsys/sshd
echo "sshd"
;;
restart)
$0 stop
$0 start
;;
status)
status sshd
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0
Next issue the following command:
/sbin/chkconfig --add sshd
Create a file called /etc/init.d/sshd Here is the contents:
#!/sbin/sh
#
# Start/Stop the Secure Shell Daemon - SSHD
#
# Written by Jay Emerson, September 20, 1999
# with advice from Paul Gluhosky.
case "$1" in
'start')
if [ -f /usr/local/sbin/sshd ]; then
/usr/local/sbin/sshd
echo "Started Secure Shell Daemon"
fi
;;
'stop')
kill -9 `ps -ef | grep sshd | grep -v grep | awk '{print $2}'`
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit 0
Next copy the file to the startup directory:
cp /etc/init.d/sshd /etc/rc2.d/S95sshd
Create a file called /sbin/init.d/sshd Here is the contents:
#!/sbin/sh
#
# Start/Stop the Secure Shell Daemon - SSHD
#
# Written by Jay Emerson, September 20, 1999
# with advice from Paul Gluhosky.
case "$1" in
'start')
if [ -f /usr/local/sbin/sshd ]; then
/usr/local/sbin/sshd
echo "Started Secure Shell Daemon"
fi
;;
'stop')
kill -9 `ps -ef | grep sshd | grep -v grep | awk '{print $2}'`
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit 0
Next copy the file to the startup directory:
cp /sbin/init.d/sshd /sbin/rc3.d/S95sshd
Next
Previous
Contents
|