![]() |
LINUX |
opensshクライアント
・LinuxのSECUREな通信を目的とします
・クライアントのsshはrpmパッケージのopensshを使います
・"protocol2 PubkeyAuthentication"を使います
・ログイン端末で "#" はroot、"$" は一般ユーザのプロンプトの記号です
・設定ファイルで "#" で始まる行はコメントとして解釈されます
参照ファイル:opensshマニュアルetc.
仮設定| :ローカルホスト | mars.528p.com |
| :ユーザ | sola |
| :サーバ | venus.528p.com |
| :ユーザ | sola |
ローカルホスト上でDSA認証鍵を作ります・ユーザのディレクトリに .sshディレクトリが作られます
・id_dsa(DSA秘密鍵)id_dsa.pub(DSA公開鍵)が収納されます
[sola@mars:~] $ ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/home/sola/.ssh/id_dsa):← Enterキー Created directory '/home/sola/.ssh'. Enter passphrase (empty for no passphrase):← パスフレーズを入力 Enter same passphrase again:← 再入力 Your identification has been saved in /home/sola/.ssh/id_dsa. Your public key has been saved in /home/sola/.ssh/id_dsa.pub. The key fingerprint is: 8b:f4:36:d3:0d:1e:13:54:21:c8:eb:1b:e7:50:99:8d sola@earth.528p.com $
サーバ上でid_dsa.pub(DSA公開鍵)を登録します・ローカルホストからサーバにid_dsa.pub(DSA公開鍵)を転送しておきます
・専用ディレクトリをつくります
・公開鍵を専用ファイルに書き加えます
・ディレクトリとファイルのパーミッションを変更します
[sola@venus:~]
$ mkdir .ssh
$ cat id_dsa.pub >> .ssh/authorized_keys
$ chmod 700 .ssh
$ chmod 600 .ssh/authorized_keys
ログインしてみます・yesと答えるのは初回接続のみです
・ローカル側にデータベースが作られます
・鍵作成のとき入力したパスフレーズを入力します
[sola@mars:~] $ ssh -2 sola@venus.528p.com The authenticity of host 'venus.528p.com (192.168.0.1)' can't be established. RSA key fingerprint is 40:5e:29:70:b7:6c:d5:fc:28:ab:f2:06:1a:b7:ad:bb. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'venus.528p.com,192.168.0.1' (RSA) to the list of known hosts. Enter passphrase for key '/home/staff/.ssh/id_dsa':← パスフレーズを入力 [sola@venus:~] $
![]() |
Copyright(c) 528p.com All Rights Reserved. |

