目次
※RPMも参照の事。
# yum install openssl-devel # yum install tcp_wrappers-devel # yum install pam-devel
# yum -y remove openssh
# su - rpmdevel $ cd ~/src $ wget http://ftp.jaist.ac.jp/pub/OpenBSD/OpenSSH/portable/openssh-6.1p1.tar.gz $ tar zxvf openssh-6.1p1.tar.gz
$ cd ~/src $ tar zxvf openssh-6.1p1.tar.gz
$ vi openssh-6.1p1/contrib/redhat/openssh.spec %define no_x11_askpass 0 ↓ %define no_x11_askpass 1 ← (変更)x11_askpassの無効化 %define no_gnome_askpass 0 ↓ %define no_gnome_askpass 1 ← (変更)gnome_askpassの無効化 %configure \ --without-zlib-version-check \ ← (追加)zlibのバージョンチェック無効化
$ cd ~/src/openssh-6.1p1/contrib $ rm -rf aix/ $ rm -rf hpux/ $ rm -rf caldera/ $ rm -rf suse/ $ rm -rf cygwin/ $ rm -rf solaris/
$ cd ~/src $ tar zcvf openssh-6.1p1.tar.gz openssh-6.1p1/
$ cd ~/src $ rpmbuild -tb --clean openssh-6.1p1.tar.gz
$ cd /home/rpmdevel/rpm/RPMS/i686 $ sudo rpm -Uvh openssh-6.1p1-1.i686.rpm $ sudo rpm -Uvh openssh-server-6.1p1-1.i686.rpm $ sudo rpm -Uvh openssh-clients-6.1p1-1.i686.rpm
# /etc/rc.d/init.d/sshd start Starting sshd: [ OK ]
# chkconfig sshd on
# vi /etc/ssh/sshd_config #Port 22 ↓ Port 22 #SyslogFacility AUTH ↓ SyslogFacility AUTH #PermitRootLogin yes ↓ PermitRootLogin no ← rootでのログインを禁止 #PasswordAuthentication yes ↓ PasswordAuthentication no ← パスワードでのログインを禁止(鍵方式によるログインのみ許可) #PermitEmptyPasswords no ↓ PermitEmptyPasswords no ← パスワードなしでのログインを禁止
# su - hoge $ /usr/bin/ssh-keygen -t rsa ← SSH2で公開鍵・秘密鍵を作成 Generating public/private rsa key pair. Enter file in which to save the key (/home/hoge/.ssh/id_rsa): ← 鍵のファイル名を入力(空EnterでOK) Created directory '/home/hoge/.ssh' Enter passphrase (empty for no passphrase): ← パスフレーズの入力 Enter same passphrase again: ← パスフレーズの再入力 Your identification has been saved in /home/hoge/.ssh/id_rsa. Your public key has been saved in /home/hoge/.ssh/id_rsa.pub. The key fingerprint is: 〜鍵情報が表示される〜
$ cd .ssh $ ls -la 合計 16 drwx------ 2 XXXXX XXXXX 4096 3月 8 21:22 . drwx------ 16 XXXXX XXXXX 4096 3月 8 20:33 .. -rw------- 1 XXXXX XXXXX 951 3月 8 21:22 id_rsa ← 秘密鍵 -rw-r--r-- 1 XXXXX XXXXX 241 3月 8 21:22 id_rsa.pub ← 公開鍵
$ cd ~/.ssh $ cat id_rsa.pub >> authorized_keys $ rm -f ~/.ssh/id_rsa.pub ← 元の鍵を削除authorized_keysがない場合
$ cd ~/.ssh $ mv id_rsa.pub authorized_keys
$ chmod 400 ~/.ssh/authorized_keys
# cp /home/hoge/.ssh/id_rsa /mnt/floppyフロッピーにコピーされたid_rsaファイルを使用してPuTTyの接続設定を行う。