gpt4 book ai didi

ssh - 使用 ssh-keygen 更改 ssh 密码会更改 ssh key 吗?

转载 作者:行者123 更新时间:2023-12-04 18:24:15 31 4
gpt4 key购买 nike

我错误地设置了 ssh key 的密码。

但是每次使用 key 时都要输入密码很烦人。

我想删除我的 key 的密码:

$ ssh-keygen -p -f <my/key/file>

但是,我担心 key 会被更改。

由于我以多种方式使用 key ,因此这项工作似乎太危险而无法测试。

man page说,命令不会改变我认为的关键,但不确定:

-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.

最佳答案

实际上,密码短语只是对私钥文件的本地保护。从服务器的角度来看, key 保持不变。
你尝试没有危险。只需在转换前备份您的加密 key 。

虽然正确的解决方案是使用 authentication agent (如 OpenSSH ssh-agent )。使用代理,您只需在将 key 加载到代理时键入一次密码。

如果您想要/需要某个自动化的未加密 key ,正确的解决方案是拥有两个 key 。一种加密用于交互使用,另一种未加密用于无人值守使用。因此,万一您的未加密 key 被泄露,您可以取消它而无需替换您的加密 key 。

关于ssh - 使用 ssh-keygen 更改 ssh 密码会更改 ssh key 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49550018/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com