コマンドでの公開鍵・秘密鍵の生成
シェル上で鍵ペアの作成を行うには、ssh-keygenコマンドを実行します。
$ ssh-keygen -t rsa ※RSA暗号での鍵作成開始 Generating public/private rsa key pair. Enter file in which to save the key (/home/hoge/.ssh/id_rsa): ※パスフレーズを保存する鍵を指定する。Enterキーを押す 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: d2:bc:91:1b:8e:2b:68:c7:59:79:c9:49:38:f0:8e:2e hoge@hoge.com $ .ssh% ls -l ~/.ssh ※秘密鍵(id_rsa)と公開鍵(id_rsa.pub)が作成されている -rw------- 1 hoge hoge 1743 2009-12-25 14:10 id_rsa -rw-r--r-- 1 hoge hoge 403 2009-12-25 14:10 id_rsa.pub $ mv ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys(または、"cat id_rsa.pub >> ~/.ssh/authorized_keys") ※すでに"authorized_keys"が存在している場合は、"cat id_rsa.pub >> ~/.ssh/authorized_keys"のように追記を行います $ chmod 600 ~/.ssh/authorized_keys
鍵ペアの生成が完了したら、USBなどをマウントして秘密鍵(id_rsa)コピーし、任意のフォルダに配置します。
あとは、PoderosaやTeratermなどの端末エミュレータソフトで通信する際のダイアログで鍵ファイルのパスを指定すれば接続できるようになります。
最終更新 2009-12-25

この記事へのコメント
まだコメントは投稿されていません。