たいちょの部屋 SSH インストール手順書

ローカルのIPのみの割り当てなのでtelnetを有効にする
(/etc/inetd.conf で telnet の行頭にコメントがついてないことを確認)
※デフォルトでtelnetが有効になっている。が、rootでは端末からのtelnetは許可されていないので注意
※telnetを行うときには追加したユーザアカウントでログインすること。
※sshをインストールした後には telnet の行頭を#でコメントアウトしてTELNETを落とすこと。
(inetd.confを書き換えた後には コマンド #pkill -HUP inetd を実行する)
--------------------

●作業内容
デフォルトでインストールした後に COMPANION CD を利用して必要なバイナリパッケージをインストール。
すべてカスタムインストールで 必要最低限 gcc 。
LANGUAGE → gcc

インストールが終了したら 作業を行うためのユーザを登録。(必須です)
# useradd -g xxx -m -d /export/home/[user] -c [comment] -s /bin/csh [user]

登録したユーザでログインしなおす。


OpenSSHをインストールする

①zlib
%cd /usr/local/src (ver1.1.4)
%gtar zxvf /tmp/zlib/zlib-1.1.4.tar.gz
% ./configure
%make
% su
# make install

②OPENsslをインストールする(ver 0.9.6d)
%cd /usr/local/src
%gtar zxvf /tmp/Openssl/openssl-0.9.6d.tar.gz
%cd openssl-0.9.6d
%./config
%make
%su
Password:
# make install

※OPENsshをインストールする(ver 3.4p.1 現時点での最新です)
(http://ushiolab.sys.es.osaka-u.ac.jp/~tatsushi/install/install_log.html#opensshを参照しました。
%cd /usr/local/src
%gtar zxvf /tmp/Openssh/openssh-3.4p1.tar.gz
%cd openssh-3.4p1
%./configure --with-pam --with-ipv4-default --with-privsep-path=/var/empty/sshd

%make
%su
Password:
# mkdir -p /var/empty/sshd
# chown root:sys /var/empty/sshd
# chmod 755 /var/empty/sshd
# groupadd -g 500 sshd (グループidの500は任意です)
# useradd -g sshd -d /var/empty/sshd -s /bin/false -c "SSH user" sshd
#

PAMを変更する
 /etc/pam.conf

sshd auth required /usr/lib/security/pam_unix.so.1
sshd account required /usr/lib/security/pam_unix.so.1
sshd session required /usr/lib/security/pam_unix.so.1
sshd password required /usr/lib/security/pam_unix.so.1

# make install

※sshのチューニングをする
# vi /usr/local/etc/sshd_config (さーば側)

設定した内容
Port 22
Protocol 2,1
# HostKey for protocol version 1
HostKey /usr/local/etc/ssh_host_key
LogLevel INFO
PermitRootLogin no
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no
PermitEmptyPasswords no
PrintMotd no


#vi /usr/local/etc/ssh_config(クライアント側はデフォルト)

自分の鍵をつくる
% /usr/local/bin/ssh-keygen -t rsa1

shhdを起動する
su してから
動作確認(デバックモード)
# /usr/local/sbin/sshd -d -t -f /usr/local/etc/sshd_config

自動起動するように設定する。

# 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')
if [ "${pid}" != "" ]
then
/usr/bin/kill ${pid}
fi
;;
*)
echo "usage: /etc/init.d/sshd {start|stop}"
;;
esac


# chown root /etc/init.d/sshd
# chgrp sys /etc/init.d/sshd
# chmod 555 /etc/init.d/sshd
# ln -s /etc/init.d/sshd /etc/rc2.d/S98sshd

# /etc/rc2.d/S98sshd start



Back