Computing.Net > Forums > Solaris > Start sshd during boot up

Start sshd during boot up

Reply to Message Icon

Original Message
Name: m7364m
Date: October 30, 2003 at 14:08:02 Pacific
Subject: Start sshd during boot up
OS: Solaris 9
CPU/Ram: Sparc
Comment:

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


Report Offensive Message For Removal

Response Number 1
Name: Robert
Date: October 30, 2003 at 14:18:33 Pacific
Subject: Start sshd during boot up
Reply: (edit)

I think the link must begin with a capital S, S98sshd.


Report Offensive Follow Up For Removal

Response Number 2
Name: m7364m
Date: October 30, 2003 at 15:09:57 Pacific
Subject: Start sshd during boot up
Reply: (edit)

That was a great help, Thanks a lot!


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Start sshd during boot up

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software