我有一个现有的公钥/私钥对.私钥受密码保护,加密可以是RSA或DSA.这些键是使用ssh-keygen生成的类型,通常存储在〜/ .ssh下.
我想更改私钥的密码.我如何在标准的Unix shell上进行操作?
另外,我该如何删除密码?只需将其更改为空?
要更改默认DSA密钥上的密码,请执行以下操作:
$ssh-keygen -p -f ~/.ssh/id_dsa
然后在提示时提供您的新旧密码(两次). (如果你有RSA密钥,请使用〜/ .ssh / id_rsa.)
man ssh-keygen的更多细节:
[...] SYNOPSIS ssh-keygen [-q] [-b bits] -t type [-N new_passphrase] [-C comment] [-f output_keyfile] ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile] [...] -f filename Specifies the filename of the key file. [...] -N new_passphrase Provides the new passphrase. -P passphrase Provides the (old) passphrase. -p Requests changing the passphrase of a private key file instead of creating a new private key. The program will prompt for the file containing the private key,for the old passphrase,and twice for the new passphrase. [...]