既存の秘密鍵にパスフレーズを追加したり、更新をする場合は、ssh-keygenで「-p」オプションを用いる。

ssh-keygen -p -f 秘密鍵ファイルのPATH

[root@BS-PUB-CENT7-01 ~]# # パスフレーズのない鍵ファイルに追加する
[root@BS-PUB-CENT7-01 ~]# ssh-keygen -p -f ./test
Key has comment './test'
Enter new passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved with the new passphrase.
[root@BS-PUB-CENT7-01 ~]#
[root@BS-PUB-CENT7-01 ~]# # パスフレーズのある鍵ファイルでフレーズを更新する
[root@BS-PUB-CENT7-01 ~]# ssh-keygen -p -f ./test
Enter old passphrase:
Key has comment './test'
Enter new passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved with the new passphrase.