I wanted to start sshd during bootup and have created a soft link
/etc/rc2.d/s98sshd -> /etc/init.d/sshd.
sshd file has the script written below, but whenever I restart the server, sshd is not running and I have to execute "/etc/rc2.d/s98sshd start" to start the ssh daemon manually.
Any help would be appreciated.
Thanks,
m7364m
#!/sbin/sh
#
# Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
#
# ident "@(#)sshd 1.1 01/09/19 SMI"
#
# If sshd is configured (/etc/ssh/sshd_config exists and is readable),
# the start it up.
# Checks to see if RSA, and DSA host keys are available
# if any of these keys are not present, the respective keys are created.
KEYDIR=/usr/local/etc
KEYGEN="/usr/local/bin/ssh-keygen -q"
PIDFILE=/var/run/sshd.pid
case $1 in
'start')
if [ -x /usr/local/bin/ssh-keygen ]; then
if [ ! -f "$KEYDIR/ssh_host_rsa_key" ]; then
echo "Creating new RSA public/private host key pair"
$KEYGEN -f $KEYDIR/ssh_host_rsa_key -t rsa -N ''
fi
if [ ! -f "$KEYDIR/ssh_host_dsa_key" ]; then
echo "Creating new DSA public/private host key pair"
$KEYGEN -f $KEYDIR/ssh_host_dsa_key -t dsa -N ''
fi
fi
[ -x /usr/local/sbin/sshd ] && /usr/local/sbin/sshd &
;;
'stop')
#
# If we are switching Run level downwards then we disconnect
# all connections.
#
# Otherwise we just kill the master daemon that is listening
# and leave the connections active
if [ -z "$_INIT_RUN_LEVEL" ]; then
set -- `/usr/bin/who -r`
_INIT_RUN_LEVEL="$7"
_INIT_PREV_LEVEL="$9"
fi
if [ $_INIT_RUN_LEVEL -lt $_INIT_PREV_LEVEL ]; then
/usr/bin/pkill -u 0 -x sshd
fi
if [ -f "$PIDFILE" ]; then
/usr/bin/kill -TERM `/usr/bin/cat $PIDFILE`
fi
;;
'restart')
if [ -f "$PIDFILE" ]; then
/usr/bin/kill -HUP `/usr/bin/cat $PIDFILE`
fi
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac