在共享计算机上管理私钥的最佳方法

时间:2018-08-07 08:22:16

标签: git security private-key

我想知道一种安全的方法来管理共享计算机中的私钥。 私钥用于GitHub身份验证,将pull / push / clone /拖到“ git:// ...”。但是,PC与其他人共享。其中一些可以是root用户,因此他们可以读取我的私钥。如果他们阅读了,他们将拥有对我的存储库的访问权限。另外,我的GitHub密码太长了,难以记住。它是由密码管理应用程序生成的,因此我不记得了。因此,我无法使用Git URL“ https:// ...”键入密码。

我想要做的是以安全方式在共享PC中使用git。 您能给我一些建议或解决方案吗?

1 个答案:

答案 0 :(得分:1)

在git控制台中,您可以在生成密钥时向其添加密码。

基本执行ssh-keygen,它将询问您密钥的位置以及所需的密码。

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Generating public/private rsa key pair.
Enter file in which to save the key (/home/private/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): [PASSPHRASE]
Enter same passphrase again: [PASSPHRASE]
Your identification has been saved in /home/private/.ssh/id_rsa.
Your public key has been saved in /home/private/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:SPGTnzBrBfGCktlJm3iNRepVRS4XymcCrs3zq/g4g2g your_email@example.com
The key's randomart image is:
+---[RSA 4096]----+
|      o.*..o+    |
|     * & B o .   |
|    = @ @ B =    |
|     = * O B     |
|      + S o      |
|       . o       |
|   . .    .      |
|  E . oo   .     |
| .    o+o..      |
+----[SHA256]-----+

这是github的深入教程:

https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

所有现代git管理器还为生成器提供了密码短语。

相关问题