openSSHのバージョンをあげてchrootに対応する

openSSHは、v4.7以上だとちゃんとchrootに対応しているらしい。
ということで頑張って入れなおす。


でも、yum様が取ってくるopenSSHのバージョンは
4.3とかだったり(CentOS)。


仕方ないのでmake, make installします。
以下コマンドの嵐

(現在のopenSSHの停止と削除)
/etc/rc.d/init.d/sshd stop
yum -y remove openssh

(新しいバージョンのダウンロード)
wget ftp://openbsd.org/pub/OpenBSD/OpenSSH/portable
/openssh-5.0p1.tar.gz

(解凍)
tar xzf openssh-5.0p1.tar.gz
cd openssh-5.0p1

(コンフィグってメイクってインストール)
./configure --prefix=/etc/ssh
make
make install

(起動スクリプトのパスの置換と配置)
sed -e 's/\/usr\/bin/\/etc\/\/bin/' -e 's/\/usr\/sbin
/\/etc\/sbin/' contrib/redhat/sshd.init > /etc/rc.d/init.d/sshd

(起動スクリプトの修正)
vi /etc/rc.d/init.d/sshd

・・・
start()
{
・・・・
        initlog -c "$SSHD $OPTIONS" && success || failure
        ↓
        #initlog -c "$SSHD $OPTIONS" && success || failure
        $SSHD $OPTIONS && success || failure

(起動スクリプトを実行可能に)
chmod 0755 /etc/rc.d/init.d/sshd

(起動リストに追加?)
chkconfig --add sshd

(起動するか確認)
/etc/rc.d/init.d/sshd start


OpenSSH で SSH サーバー構築 | 自宅サーバFedora
http://honana.com/openssh/


SSHサーバー構築(OpenSSH+Chroot)
http://fedorasrv.com/openssh_chroot.shtml


sed 】 文字列の置換,行の削除を行う
http://itpro.nikkeibp.co.jp/article/COLUMN/20060227/230879/