Ssh
如何更改我的私鑰密碼?
我有一個現有的公鑰/私鑰對。私鑰受密碼保護,加密可以是 RSA 或 DSA。這些密鑰是您生成的類型
ssh-keygen
,通常儲存在~/.ssh
.我想更改私鑰的密碼。在標準的 Unix shell 上,我該怎麼做?
另外,我如何簡單地刪除密碼?直接改成空的?
要更改預設密鑰上的密碼:
$ ssh-keygen -p
如果需要指定密鑰,請傳遞
-f
選項:$ ssh-keygen -p -f ~/.ssh/id_dsa
然後在提示處提供您的舊密碼和新密碼(兩次)。(
~/.ssh/id_rsa
如果您有 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. [...]