Solaris8下安装SSH指南
需要下载的软件:
gcc
libgcc
openssh
openssl
prngd
tcp_wrappers
zlib
ANDIrand
这些软件可以去或者中下载。至于ANDIrand可以从以下地址下载:
下载后安装以上软件包:
# gunzip gcc*
# gunzip libgcc*
# gunzip openssh*
# gunzip openssl*
# gunzip prngd*
# gunzip tcp_wrappers*
# gunzip zlib*
# pkgadd -d gcc-3.4.6-sol8-sparc-local
# pkgadd -d openssl-0.9.8h-sol8-sparc-local
# pkgadd -d libgcc-3.3-sol8-sparc-local
# pkgadd -d zlib-1.2.3-sol8-sparc-local
# pkgadd -d tcp_wrappers-7.6-sol8-sparc-local
# pkgadd -d openssh-5.0p1-sol8-sparc-local
# pkgadd -d prngd-0.9.25-sol8-sparc-local
# pkgadd -d ANDIrand-0.7-5.8-sparc-1.pkg
安装完后创建sshd和prngd自启动脚本:
vi /etc/init.d/sshd:
#!/bin/bash
#
#
#star or stop the ssh daemon
case $1 in
start)
if [ -f /usr/local/sbin/sshd ];then
echo "Start the sshd daemon"
/usr/local/sbin/sshd &
fi
;;
stop)
PID=`/usr/bin/ps -e -u 0 | /usr/bin/fgrep sshd | /usr/bin/awk '{print $1}'`
if [ ! -z "$PID" ]; then
/usr/bin/kill ${PID} >/dev/null 2>&1
fi
;;
*)
echo "usage: /etc/init.d/sshd {start|stop}"
;;
esac
# ln -s /etc/init.d/sshd /etc/rc2.d/S99sshd
/etc/init.d/prngd:
#!/bin/bash
#
#start/stop the pseudo random generator daemon
case "$1" in
'start')
# Start the ssh daemon
if [ -f /usr/local/sbin/prngd ]; then
echo "starting PRNG daemon"
/usr/local/sbin/prngd /var/spool/prngd/pool&
fi
;;
'stop')
# Stop the ssh deamon
PID=`/usr/bin/ps -e -u 0 | /usr/bin/fgrep prngd | /usr/bin/awk '{print $1}'`
if [ ! -z "$PID" ] ; then
/usr/bin/kill ${PID} >/dev/null 2>&1
fi
;;
*)
echo "usage: /etc/init.d/prngd {start|stop}"
;;
esac
# ln -s /etc/init.d/prngd /etc/rc2.d/S99prngd
下来创建sshd的组和用户:
# mkdir /var/empty
# chown root:sys /var/empty
# chmod 755 /var/empty
# groupadd sshd
# useradd -g sshd -c 'sshd privsep' -d /var/empty -s /bin/false sshd
# chown root /etc/init.d/sshd
# chgrp sys /etc/init.d/sshd
# chmod 555 /etc/init.d/sshd
#chmod +x /etc/init.d/sshd /etc/init.d/prngd
完了后启动prngd进程:
# /etc/init.d/prngd start
starting PRNG daemon
Info: Random pool not (yet) seeded
Could not bind socket to /var/spool/prngd/pool: No such file or directory 出现这个错误,解决办法如下:
# mkdir -p /var/spool/prngd
# /etc/init.d/prngd start
starting PRNG daemon
如果出现Info: Random pool not (yet) seeded 这样的错误,是因为你没用安装ANDIrand软件包所致.
在启动sshd进程前,还得做如下操作:
#/usr/local/bin/ssh-keygen -d -f /usr/local/etc/ssh_host_dsa_key -N ""
#/usr/local/bin/ssh-keygen -b 1024 -f /usr/local/etc/ssh_host_rsa_key -t rsa -N ""
# /etc/init.d/sshd start即可!
如需要root以ssh方式登陆,还得修改/usr/local/etc/sshd_config文件,把里面的PermitRootLogin yes行前的注释符号去掉,然后重新启动sshd即可!
阅读(1186) | 评论(0) | 转发(0) |