Solaris 8 缺乏 /dev/random、/dev/urandom 裝置,導致 OpenSSH 啟動失敗。解決方案:安裝第三方 ANDIrand 套件。
# 1. 安裝 ANDIrand 提供隨機數裝置
wget https://www.cosy.sbg.ac.at/~andi/SUNrand/pkg/ANDIrand-0.7-5.8-sparc-1.pkg
pkgadd -d ANDIrand-0.7-5.8-sparc-1.pkg
# 安裝後自動建立 /dev/random /dev/urandom,無需重啟
# 2. 下載 OpenSSH 相依套件 (sunfreeware.com)
openssh-3.5p1-sol8-sparc-local.gz
openssl-0.9.6g-sol8-sparc-local.gz
zlib-1.1.4-sol8-sparc-local.gz
libgcc-3.2-sol8-sparc-local.gz
tcp_wrappers-7.6-sol8-sparc-local.gz (推薦)
# 可選: perl, prngd, egd (已由 ANDIrand 替代)
# 解壓
gunzip *.gz
# 安裝核心套件 (順序重要: zlib -> openssl -> libgcc -> tcp_wrappers -> openssh)
pkgadd -d zlib-1.1.4-sol8-sparc-local
pkgadd -d openssl-0.9.6g-sol8-sparc-local
pkgadd -d libgcc-3.2-sol8-sparc-local
pkgadd -d tcp_wrappers-7.6-sol8-sparc-local
pkgadd -d openssh-3.5p1-sol8-sparc-local
# 所有互動提示輸入 y
# 確認安裝路徑
/usr/local/bin/ssh -V
/usr/local/sbin/sshd -V
# 加入 PATH
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
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
# /var/empty 必須為空目錄
# /etc/hosts.deny
sshd: ALL
# /etc/hosts.allow
sshd: 192.168.1. 10.0.0. # 允許內網段
# sshd: .example.com # 或允許網域
ssh-keygen -t rsa1 -f /usr/local/etc/ssh_host_key -N ""
ssh-keygen -t dsa -f /usr/local/etc/ssh_host_dsa_key -N ""
ssh-keygen -t rsa -f /usr/local/etc/ssh_host_rsa_key -N ""
# 每條指令需等待數分鐘完成 (視 CPU 速度)
vi /etc/init.d/sshd
#!/bin/sh
pid=`/usr/bin/ps -e | /usr/bin/grep sshd | /usr/bin/sed -e 's/^ *//' -e 's/ .*//'`
case $1 in
start) /usr/local/sbin/sshd ;;
stop) [ -n "${pid}" ] && /usr/bin/kill ${pid} ;;
*) echo "Usage: $0 {start|stop}"; exit 1 ;;
esac
chown root:sys /etc/init.d/sshd
chmod 555 /etc/init.d/sshd
ln -s /etc/init.d/sshd /etc/rc2.d/S98sshd
ln -s /etc/init.d/sshd /etc/rc0.d/K02sshd
ln -s /etc/init.d/sshd /etc/rc1.d/K02sshd
# 啟動測試
/etc/init.d/sshd start
ps -ef | grep sshd
# 從用戶端測試
ssh user@solaris8_host
# 或指定 IP
ssh user@192.168.1.100
sshd 用戶與 /var/empty 會導致 sshd 拒絕啟動。