我使用puttygen生成了一个OpenSSH私钥(并以OpenSSH格式导出)。如何在现有密钥上设置密码(我知道如何使用密码生成新密钥)?
发布于 2018-03-23 15:25:12
尝试命令ssh-keygen -p -f keyfile
从ssh-keygen手册页
-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.
-f filename
Specifies the filename of the key file.
例子:
ssh-keygen -p -f ~/.ssh/id_rsa
发布于 2018-03-23 16:21:53
使用-p选项对ssh-keygen。这允许你更改密码,而不是生成新密钥。
更改密码
ssh-keygen -p -f ~/.ssh/id_rsa
所需密码将是新密码。(这假定已经添加了公钥。~/.ssh/id_rsa.pub
致你的授权_(密钥文件)。使用ssh进行测试:
ssh -i ~/.ssh/id_rsa localhost
https://stackoverflow.com/questions/-100003676
复制相似问题