[ 永远的UNIX::UNIX技术资料的宝库 ]

首页 > 系统管理 > 其它 > 正文
从UNIX的启动脚本中初始化Secure Shel
本文出自:http://www.china-pub.com 作者: 东方高 (2001-08-09 09:00:00)
运行Secure Shell的大多数系统管理员都希望它总是处于运行状态,并且也不希望每次都要启动它,才能使其运行。解决这个问题的一个简单的办法就是将其置于一个启动程序脚本中。表1显示了不同的操作系统中启动Secure Shell守护进程的位置。

  在Linux系统安装过程中,程序脚本也自动地被安装了进来。如果发现你需要编辑程序脚本并希望能增加对Secure Shell的启动,你可以将下列的程序脚本添加进来。

表1 启动脚本位置

操作系统      启动程序脚本   操作系统    启动程序脚本

Slackware Linux   /etc/rc.d     Irix      /etc/rc*.d

Red hat Linux     /etc/rc*.d    AIX       /etc

Solaris        /sbin/rc*.d    DEC UNIX    /sbin/rc*.d

HP-UX         /sbin/rc*.d

我的UNIX系统是Slackware Linux系统,网络初始化程序脚本为/etc/rc.d/inet2,在这个脚本中,你将发现Secure Shell已经启动。如果你希望做到这一点,可以编辑启动程序脚本以正确的路径将Secure Shell守护进程增加进去,并设置你所需要的选项。

#!/bin/sh
#
# rc.inet2 This shell script boots up the entire INET

# system.Note, that when this script is used to

# also fire up any important remote NFS disks

# (like the /usr distribution),care must be

# taken to actually have all the needed binaries

# online_now_...

#Author: Fred N. van Kempen.

<waltje@uwalt.nl.mugnet.org>
#
#Constants.

NET=”/usr/sbin”

IN_SERV =”1pd”

LPPOOL=”/var/spool/1pd”

#At this point , we are ready to talk to The world...

#echo “Mounting remote file systems...”

#/sbin/mount –a –t nfs #This may be our /usr runtime!!!

Echo –n “Starting daemons:”

#Start tge SYSLOGD/Klogd daemons.These must come first.

If [-f ${NET}/syslogd]; then

Echo –n”syslogd”

${NET}/syslogd
sleep l # prevent syslogd/klogd race condition on SMP]

#kernels

echo –n ”klogd”

${NET}/klogd

fi

# Start the SUN RPC Portmapper.

If[ -f ${NET}/rpc.portmap]; then

Echo –n “ortmap”

${NET}/rpc.portmap

fi

#Start tge INET SuperServer

if[-f ${NET}/inetd]; then

echo –n”inetd

${NET}/inetd

else

echo “ no INETD found. INET cancelled!”

exit l

fi

# Look for sshd in the two most common locations

#(compiled with –prefix=/usr or with – prefix=/usr/local)

#and if we find it. Start it up

if[ -x /usr/local/sbin/sshd]: then

echo –n “sshd”

/usr/local/sbin/sshd

elif [ -x /usr/sbin/sshd]; then

echo –n “sshd”

/usr//sbin/sshd

fi

# Start the various UBET servers.

For server in $[IN_SERV]; do

If[-f ${NET}/${server}]; then

# Start the NFS server daemons.

If[-f ${NET}/rpc.mount]; then

Echo –n “mount”

${NET}/rpc.mount

fi

if[-f ${NET}/rpc.nfsd]; then

echo –n ”nfsd”

${NET}/rpc.nfsd

fi

fi# Done starting various SUN RPC servers.

#The ’echo’ below will put a carriage return at the end

# of the list of started servers.

Echo

# Done

(http://www.fanqiang.com)
    进入【UNIX论坛


相关文章
 

★  樊强制作 欢迎分享  ★