我们经常发布文档更新,此页面的翻译可能仍在进行中。有关最新信息,请访问英文文档。如果此页面上的翻译有问题,请告诉我们

此版本的 GitHub Enterprise 已停止服务 March 02, 2021. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

使用 SSH 密钥密码

您可以保护 SSH 密钥并配置身份验证代理,这样您就不必在每次使用 SSH 密钥时重新输入密码。

本文内容

使用 SSH 密钥时,如果有人获得您计算机的访问权限,他们也可以使用该密钥访问每个系统。 要添加额外的安全层,可以向 SSH 密钥添加密码。 您可以使用 ssh-agent 安全地保存密码,从而不必重新输入。

添加或更改密码

通过输入以下命令,您可以更改现有私钥的密码而无需重新生成密钥对:

$ ssh-keygen -p -f ~/.ssh/id_ed25519
> Enter old passphrase: [Type old passphrase]
> Key has comment 'your_email@example.com'
> Enter new passphrase (empty for no passphrase): [Type new passphrase]
> Enter same passphrase again: [Repeat the new passphrase]
> Your identification has been saved with the new passphrase.

如果您的密钥已有密码,系统将提示您输入该密码,然后才能更改为新密码。

延伸阅读