「Linux入門」ssh-keygenコマンドの使い方
1.ssh-keygenコマンド
ssh-keygen [option] -t 鍵タイプ [-N newpassword [-C コメント] [-f 鍵ファイル]
ssh-keygen -p [-P oldpassword] [-N newpassword [-f 鍵ファイル]
ssh-keygen -i [-f 鍵ファイル]
ssh-keygen -l [-f 鍵ファイル]
2.RSA暗号の鍵の生成
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/yamada/.ssh/id_rsa): ← Enterを押す
Created directory '/home/yamada/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/yamada/.ssh/id_rsa.
Your public key has been saved in /home/yamada/.ssh/id_rsa.pub.
3.パスフレーズを変更する
$ ssh-keygen -p
Enter file in which the key is (/home/yamada/.ssh/id_rsa):
Enter old passphrase:
Key has comment '/home/yamada/.ssh/id_rsa’
Enter new passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved with the new passphrase.
4.鍵ファイルの変換
# ssh-keygen -i -f id_rsa.pub >> authorized_keys