我可以在另一台机器上使用我的 ssh 密钥对吗

发布于 2024-12-02 09:38:54 字数 173 浏览 2 评论 0原文

我创建了一个 ssh 密钥对并将密钥作为我的 github 帐户的一部分发布。现在我想从另一台机器(例如 EC2 实例)访问我的帐户,因此我将 ~/.ssh/id_rsa* 文件复制到目标机器中并能够签出代码。

这是一个可接受的过程,还是我应该在该计算机上生成不同的密钥对并将该密钥发布到我的 github 帐户中。

I created a ssh key-pair and published the key as part of my github account. Now I would like to access my account from a different machine (say an EC2 instance), so I copied my ~/.ssh/id_rsa* files into the target machine and was able to checkout code.

Is this an acceptable procedure or should I generate a different key pair on that machine and also publishing that key into my github account.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

哆兒滾 2024-12-09 09:38:54

是的,您可以使用相同的密钥。
如果您是唯一的开发人员并且不需要任何审核日志记录,那么这确实无关紧要。

如果您作为团队的一员工作,颁发多个密钥可以在必要时轻松撤销访问权并将团队成员从一个项目转移到另一个项目。

但是,在您的实例中,您可以使用相同的 ssh 密钥对吗?.. 是的,您可以。

还有-> 您是否控制谁有权访问每台计算机?

不过,顺便说一句,我是特定项目的唯一开发人员,但在这个项目中,我在大约六个不同的站点工作。对于每个网站,我都使用了不同的密钥。我这样做是为了当我在不同的办公室工作时可以轻松地撤销访问权限。因此,在这种情况下,即使我是一名单独的开发人员,并且不需要任何日志,我仍然使用多个密钥。 (我不仅仅在现场工作,而且我无法控制谁有权访问拥有密钥的机器。)。

Yes you can use the same key.
If you are the only developer and do not require any audit logging, then it really does not matter.

If you are working as apart of a team, issuing multiple keys makes it easy to revoke access when that is necessary and move team members from one project to another.

However, in your instance, can you use the same ssh keypair?.. Yes you can.

Also -> Do you control who has access to each machine?

As a side note however, I am the only developer on a particular project, but on this project I have worked from about six different sites. For each of these sites, I have used a different key. I have done this so that I can easily revoke access when I was working from a different office. So that is one instance where even though I am a sole developer, and did not require any logs, I still used multiple keys. (I don't work just from location and I can't control who has access to the machines which have the keys.).

征棹 2024-12-09 09:38:54

在我看来,密钥标识的是用户,而不是用户正在使用的机器

所以,答案是:是的,不仅仅是复制密钥就可以了:这是唯一干净的解决方案


如果您为您正在处理的每个盒子创建一把钥匙,您会获得什么?我能看到的唯一影响是你必须管理一堆都识别同一个人的证书。这不太理想。

您使用密钥的方式与您是否是该项目的唯一开发人员无关。如果您有一百个用户,每个用户都会有一个密钥来识别他们。他们会在他们正在使用的每台机器上使用这个一个密钥。

In my opinion, the key identifies the user, not the machine the user was working on.

So, the answer is: yes, it's not just ok to copy the key: it's the only clean solution.


What would you gain if you create one key for every box you're working on? The only effect I can see is that you have to manage a bunch of certificates that all identify the same person. That's not quite desirable.

The way you use your key has nothing got to do with whether you are the only developer of the project or not. If you have a hundred users, each of them would have one key identifying them. And they would use that one key on every machine they are working on.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文