ネットワーク上のやり取りを暗号化する手段として、sshを導入する。 1.ダウンロード ftp://ftp.ssh.com/pub/ssh/ バージョン2以上では、ライセンスが必要なため、1を使用。 ssh-1.2.31.tar.gz -> /usr/local/src 2.make and install # cd /usr/local/src # tar zxvf ssh-1.2.31.tar.gz # cd ssh-1.2.31 # set path = ( $path /usr/X/bin ) # X # ./configure # make # make install # vi /etc/init.d/sshd #! /bin/sh # # start/stop the secure shell deamon case "$1" in ’start’) # Start the audit deamon if [ -f /usr/local/sbin/sshd ]; then echo "starting SSHD daemon" /usr/local/sbin/sshd & fi ;; ’stop’) # Stop the audit 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} 1>/dev/null 2>&1 fi ;; esac # # chmod 744 /etc/init.d/sshd # ln /etc/init.d/sshd /etc/rc2.d/S75sshd # ln /etc/init.d/sshd /etc/rc0.d/K39sshd # ln /etc/init.d/sshd /etc/rc1.d/K39sshd # ln /etc/init.d/sshd /etc/rcS.d/K39sshd # vi /etc/services sshd 22/tcp # Add sshd # /etc/init.d/sshd # 3.sshを通す。 クライアント側にもインストールすれば、クライアントから ssh マシン名 で パスワード認証によりサーバ側にログインすることが出来るが、公開鍵暗号認証に しておく方が良いので、クライアントユーザにて以下のことを行う。 % ssh-keygen1 Initializing random number generator... Generating p: ................................++ (distance 538) Generating q: .....................++ (distance 362) Computing the keys... Testing the keys... Key generation complete. Enter file in which to save the key (/home/oracle/.ssh/identity): Enter passphrase: Enter the same passphrase again: Your identification has been saved in /home/oracle/.ssh/identity. Your public key is: : : : : Your public key has been saved in ~/.ssh/identity.pub そして、クライアントのローカルに作成された ~/.ssh/identity.pub の内容を サーバ・ユーザの ~/.ssh/authorized_keys に追加することで、パスワードの 認証ではなく、ssh-keygen1で生成したパスフレーズで認証されることになる。 ssh-keygent1でパスフレーズを省略すると、ログインするときにも不要になる。 |