如何在不使用.pem文件的情况下SSH到EC2(Windows)?

时间:2018-10-06 15:40:18

标签: amazon-web-services amazon-ec2 ssh

我想在不使用Windows上的.pem文件的情况下切换到EC2实例。 而不是使用 ssh -i /path/my-key-pair.pem ec2-user@public-dns-hostnamedocumentation中所述,我想使用 ssh ec2-user@public-dns-hostname 我读到您需要更改.ssh目录的权限,但是对于Windows我该怎么做呢? 解决我的问题的最佳方法是什么?

谢谢:)

1 个答案:

答案 0 :(得分:0)

您可以使用=文件来完成此操作。例如:

~/.ssh/config

使用此配置,您只需执行Host ec2-ip-or-dns-name User ec2-user PreferredAuthentications publickey Port 22 IdentityFile c:/path/to/my-ec2-key.pem IdentitiesOnly yes ,而无需指定用户或ssh ec2-ip-or-dns-name文件。