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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Start sshd during boot up

Reply to Message Icon

Name: m7364m
Date: October 30, 2003 at 14:08:02 Pacific
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



Sponsored Link
Ads by Google

Response Number 1
Name: Robert
Date: October 30, 2003 at 14:18:33 Pacific
Reply:

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


0

Response Number 2
Name: m7364m
Date: October 30, 2003 at 15:09:57 Pacific
Reply:

That was a great help, Thanks a lot!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Solaris Forum Home


Sponsored links

Ads by Google


Results for: Start sshd during boot up

boot up password www.computing.net/answers/solaris/boot-up-password/3532.html

Starting an application at bootup www.computing.net/answers/solaris/starting-an-application-at-bootup/2005.html

Fail to start sshd www.computing.net/answers/solaris/fail-to-start-sshd/2343.html