Solaris8上安装openssh
下载地址:ftp://ftp.sjtu.edu.cn/sites/ftp.sunfreeware.com/pub/freeware/sparc/5.8/
下载的文件:
libgcc-3.4.6-sol8-sparc-local.gz
openssh_bsm-4.3p2-sol8-sparc-local.gz
openssl-0.9.8d-sol8-sparc-local.gz
prngd-0.9.25-sol8-sparc-local.gz
zlib-1.2.3-sol8-sparc-local.gz
还需要下载http://www.cosy.sbg.ac.at/~andi/SUNrand/pkg/ANDIrand-0.7-5.8-sparc-1.pkg
将上述文件上传到/package/下。
登陆系统
SunOS 5.8
login: root
Password:
Last login: Wed Jun 13 18:32:50 from 192.168.150.110
Sun Microsystems Inc. SunOS 5.8 Generic Patch February 2004
You have new mail.
root@mem #
root@mem # cat /etc/release
Solaris 8 2/04 s28s_hw4wos_05a SPARC
Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
Assembled 08 January 2004
root@mem #
root@mem # uname -a
SunOS mem 5.8 Generic_117350-28 sun4u sparc SUNW,Sun-Fire-V890
root@mem # mkdir /package
上传步骤略。
root@mem # cd /package/
root@mem # gunzip openssh_bsm-4.3p2-sol8-sparc-local.gz
root@mem # pkgadd -d openssh_bsm-4.3p2-sol8-sparc-local
The following packages are available:
1 SMCossh432b openssh
(sparc) 4.3p2
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 回车
Processing package instance <SMCossh432b> from </package/openssh_bsm-4.3p2-sol8-sparc-local>
openssh
(sparc) 4.3p2
The OpenSSH Group
Using </usr/local> as the package base directory.
## Processing package information.
...省略
Installation of <SMCossh432b> was successful.
root@mem #
root@mem # gunzip openssl-0.9.8d-sol8-sparc-local.gz
root@mem # pkgadd -d openssl-0.9.8d-sol8-sparc-local
The following packages are available:
1 SMCosl98d openssl
(sparc) 0.9.8d
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 回车
Processing package instance <SMCosl98d> from </package/openssl-0.9.8d-sol8-sparc-local>
openssl
(sparc) 0.9.8d
The OpenSSL Group
The selected base directory </usr/local/ssl> must exist before
installation is attempted.
Do you want this directory created now [y,n,?,q] y
Using </usr/local/ssl> as the package base directory.
## Processing package information.
...省略
Installation of <SMCosl98d> was successful.
root@mem #
root@mem # gunzip prngd-0.9.25-sol8-sparc-local.gz
root@mem # pkgadd -d prngd-0.9.25-sol8-sparc-local
The following packages are available:
1 SMCprngd prngd
(sparc) 0.9.25
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:回车
Processing package instance <SMCprngd> from </package/prngd-0.9.25-sol8-sparc-local>
prngd
(sparc) 0.9.25
Lutz Jaenicke
Using </usr/local> as the package base directory.
## Processing package information.
...省略
Installation of <SMCprngd> was successful.
root@mem #
root@mem # gunzip zlib-1.2.3-sol8-sparc-local.gz
root@mem # pkgadd -d zlib-1.2.3-sol8-sparc-local
The following packages are available:
1 SMCzlib zlib
(sparc) 1.2.3
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 回车
Processing package instance <SMCzlib> from </package/zlib-1.2.3-sol8-sparc-local>
zlib
(sparc) 1.2.3
Jean-loup Gailly
Using </usr/local> as the package base directory.
...省略
Installation of <SMCzlib> was successful.
root@mem #
root@mem # vi /etc/init.d/sshd #添加以下内容
#! /bin/sh
#
# start/stop the secure shell daemon
case "$1" in
'start')
# Start the sshd daemon
if [ -f /usr/local/sbin/sshd ]; then
echo "starting SSHD daemon"
/usr/local/sbin/sshd &
fi
;;
'stop')
# Stop the ssh deamon
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
root@mem # chmod +x /etc/init.d/sshd
root@mem # ls -al /etc/init.d/sshd
-rwxr-xr-x 1 root other 491 Jun 14 12:00 /etc/init.d/sshd
root@mem # ln -s /etc/init.d/sshd /etc/rc2.d/SArrayArraysshd
root@mem # vi /etc/init.d/prngd #添加以下内容
#! /bin/sh
#
# 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
root@mem # chmod +x /etc/init.d/prngd
root@mem # ln -s /etc/init.d/prngd /etc/rc2.d/SArrayArrayprngd
root@mem #
root@mem # mkdir -p /var/spool/prngd
root@mem #/etc/init.d/prngd start
starting PRNG daemon
root@mem # Info: Random pool not (yet) seeded
socket /var/spool/prngd/pool already used by another process, exiting.
Jun 14 12:08:59 mem prngd[14856]: [ID 816880 daemon.alert] socket /var/spool/prngd/pool already used by another process, exiting.
报Info: Random pool not (yet) seeded等信息,需要安装ANDIrand-0.7-5.8-sparc-1.pkg包。
root@mem # pwd
/package
root@mem #ls -al
total 33546
drwxr-xr-x 2 root other 512 Jun 14 12:11 .
drwxr-xr-x 31 root root 1024 Jun 14 12:11 ..
-rw-r--r-- 1 root other 35840 Jun 14 12:11 ANDIrand-0.7-5.8-sparc-1.pkg
-rw-r--r-- 1 root other 859231 Jun 14 11:46 openssh_bsm-4.2p1-sol8-sparc-local.gz
-rwxr-xr-x 1 root other 2651648 Jun 14 11:45 openssh_bsm-4.3p2-sol8-sparc-local
-rw-r--r-- 1 root other 11910656 Jun 14 11:55 openssl-0.9.8d-sol8-sparc-local
-rw-r--r-- 1 root other 166912 Jun 14 11:57 prngd-0.9.25-sol8-sparc-local
-rw-r--r-- 1 root other 1497088 Jun 14 11:59 zlib-1.2.3-sol8-sparc-local
root@mem # chmod +x ANDIrand-0.7-5.8-sparc-1.pkg
root@mem # pkgadd -d ANDIrand-0.7-5.8-sparc-1.pkg
The following packages are available:
1 ANDIrand random-0.7
(sparc) 0.7
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 回车
This package contains scripts which will be executed with super-user
permission during the process of installing this package.
Do you want to continue with the installation of <ANDIrand> [y,n,?] y
Installing random-0.7 as <ANDIrand>
...省略
Installation of <ANDIrand> was successful.
root@mem #
root@mem # /etc/init.d/prngd stop
root@mem #/etc/init.d/prngd start
starting PRNG daemon
root@mem #
root@mem # /etc/init.d/sshd stop
root@mem # /etc/init.d/sshd start
starting SSHD daemon
root@mem # ld.so.1: sshd: fatal: libgcc_s.so.1: open failed: No such file or directory
报这个错的话,需要安装libgcc-3.4.6.sol8-sparc-logcal包。
root@mem #
root@mem # /etc/init.d/sshd stop
root@mem #gunzip libgcc-3.4.6-sol8-sparc-local.gz
root@mem # pkgadd -d libgcc-3.4.6-sol8-sparc-local
The following packages are available:
1 SMClgcc346 libgcc
(sparc) 3.4.6
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 回车
Processing package instance <SMClgcc346> from </package/libgcc-3.4.6-sol8-sparc-local>
libgcc
(sparc) 3.4.6
FSF
Using </usr/local> as the package base directory.
...省略
Installation of <SMClgcc346> was successful.
root@mem #
root@mem #
打开22端口,也就是将其注释去掉。
root@mem # more /usr/local/etc/sshd_config
...省略
Port 22
#Protocol 2,1
...省略
root@mem # /etc/init.d/sshd stop
root@mem #/etc/init.d/sshd start
starting SSHD daemon
root@mem # Could not load host key: /usr/local/etc/ssh_host_key
Could not load host key: /usr/local/etc/ssh_host_rsa_key
Could not load host key: /usr/local/etc/ssh_host_dsa_key
Disabling protocol version 1. Could not load host key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available -- exiting.
报key不存在,那么创建key,使用下面的命令:
root@mem # /etc/init.d/sshd stop
root@mem # /usr/local/bin/ssh-keygen -d -f /usr/local/etc/ssh_host_dsa_key -N ""
Generating public/private dsa key pair.
Your identification has been saved in /usr/local/etc/ssh_host_dsa_key.
Your public key has been saved in /usr/local/etc/ssh_host_dsa_key.pub.
The key fingerprint is:
e2:74:a4:99:17:d6:fd:6f:dc:93:bc:12:5d:46:d6:9c root@mem
root@mem #
root@mem #/usr/local/bin/ssh-keygen -b 1024 -f /usr/local/etc/ssh_host_rsa_key -t rsa -N ""
Generating public/private rsa key pair.
Your identification has been saved in /usr/local/etc/ssh_host_rsa_key.
Your public key has been saved in /usr/local/etc/ssh_host_rsa_key.pub.
The key fingerprint is:
d6:7d:e7:fe:3b:1c:37:5f:63:d1:ca:d6:95:3f:30:b7 root@mem
root@mem #
root@mem # /etc/init.d/sshd start
starting SSHD daemon
root@mem # Could not load host key: /usr/local/etc/ssh_host_key
Disabling protocol version 1. Could not load host key
Privilege separation user sshd does not exist
root@mem # /etc/init.d/sshd stop
root@mem #
将Protocol 2,1 都放开,也就是去掉其注释:
root@mem # vi /usr/local/etc/sshd_config
...省略
Port 22
Protocol 2,1
...省略
root@mem #/etc/init.d/sshd start
starting SSHD daemon
root@mem # Could not load host key: /usr/local/etc/ssh_host_key
Disabling protocol version 1. Could not load host key
Privilege separation user sshd does not exist
root@mem # ps -ef | grep ssh
root 17676 10594 0 12:40:57 pts/3 0:00 grep ssh
报:Privilege separation user sshd does not exist ,用户sshd不存在,那么使用下面的命令创建用户:
root@mem # mkdir /var/empty
root@mem # chown root:sys /var/empty/
root@mem # chmod 755 /var/empty/
root@mem # groupadd sshd
root@mem #useradd -g sshd -c 'sshd privsep' -d /var/empty -s /bin/false sshd
root@mem #
root@mem # ls -al /etc/init.d/sshd
-rwxr-xr-x 1 root other 491 Jun 14 12:10 /etc/init.d/sshd
root@mem #
root@mem # chown root /etc/init.d/sshd
root@mem # chgrp sys /etc/init.d/sshd
root@mem # chmod 555 /etc/init.d/sshd
root@mem # /etc/init.d/sshd start
starting SSHD daemon
root@mem # Could not load host key: /usr/local/etc/ssh_host_key
Disabling protocol version 1. Could not load host key
root@mem #
root@mem # ps -ef | grep sshd
root 18474 10594 0 12:50:22 pts/3 0:00 grep sshd
root 18393 1 0 12:49:26 ? 0:00 /usr/local/sbin/sshd
root@mem #
root@mem #