简体   繁体   English

EC2生成的密钥ssh设置OSX

[英]EC2-generated key ssh setup OSX

Here's the situation: 情况如下:

  • I generated and downloaded an ssh key as a .pem file using the EC2 console 我使用EC2控制台生成并下载了一个ssh密钥作为.pem文件
  • I gave this key to my colleague with a PC and he has been able to log to the server with it just fine using PuTTY. 我用PC将这把钥匙交给了我的同事,他已经能够使用PuTTY用它登录到服务器了。
  • I have been trying for hours to figure out where to put the .pem file such that I can call 我已经花了好几个小时来弄清楚把.pem文件放到哪里,以便我可以打电话

    ssh -v [SERVER IP ADDRESS] -l [USERNAME] ssh -v [服务器IP地址] -l [USERNAME]

I know that the IP address and the username are accurate because that's what my colleague is using. 我知道IP地址和用户名是准确的,因为这是我的同事正在使用的。 Where do I put the .pem file, and what permissions do I set? 我在哪里放置.pem文件,我设置了什么权限? It seems that every tutorial on this stuff assumes you generated the key using ssh-keygen, which apparently handles all this for you, and the directions on EC2 don't tell you what to do beyond downloading the key. 似乎每个关于这个东西的教程都假设你使用ssh-keygen生成了密钥,它显然为你处理了这一切,并且EC2上的指示并没有告诉你除了下载密钥之外该做什么。

My current setup is this: 我目前的设置如下:

  • I copied the text inside the .pem file and put it in ~/.ssh/id_rsa 我将文本复制到.pem文件中并将其放在〜/ .ssh / id_rsa中
  • I set the permissions to chmod 600 id_rsa 我将权限设置为chmod 600 id_rsa
  • I'm geting a massive error that ends with the line "Permission denied (publickey)" 我正在发出一个大错误,以“Permission denied(publickey)”行结束

Thanks for your time. 谢谢你的时间。

Just use ssh -i keyfile.pem user@host.com. 只需使用ssh -i keyfile.pem user@host.com。 This will use the identity file (.pem that EC2 gave you) 这将使用身份文件(EC2给你的.pem)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM