首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何向没有密码的OpenSSH私钥中添加密码?

如何向没有密码的OpenSSH私钥中添加密码?
EN

Stack Overflow用户
提问于 2018-03-23 06:43:06
回答 2查看 0关注 0票数 0

我使用puttygen生成了一个OpenSSH私钥(并以OpenSSH格式导出)。如何在现有密钥上设置密码(我知道如何使用密码生成新密钥)?

EN

回答 2

Stack Overflow用户

发布于 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
票数 0
EN

Stack Overflow用户

发布于 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
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100003676

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档