sshの公開鍵・秘密鍵

公開鍵・秘密鍵をたまにしか作成しないのでメモ

 # ssh-keygen -t dsa  ←DSAがもっとも強力な暗号らしい

 Generating public/private dsa key pair.

 Enter file in which to save the key (/home/mazn/.ssh/id_dsa):

 Enter passphrase (empty for no passphrase): パスワード入力

 Enter same passphrase again: パスワード入力

 Your identification has been saved in /home/mazn/.ssh/id_dsa.

 Your public key has been saved in /home/mazn/.ssh/id_dsa.pub.

 The key fingerprint is:

 65:86:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx mazn@localhost

これで.sshディレクトリにid_dsaとid_dsa.pubが生成されます。
pubが公開キーです。このキーのペアをリモートのサーバに転送し、リモートサーバ上で

# cat id_dsa.pub >> ~/.ssh/authorized_keys

で登録完了

タイトルとURLをコピーしました