AWS EC2拒绝SSH登录:“Permissions for 'xxxx.pem' are too open.”

错误如下:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for 'ec2-user.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "ec2-user.pem": bad permissions
ec2-user@xxx.xxx.xxx.xxx: Permission denied (publickey).

参考资料:
https://stackoverflow.com/questions/8193768/trying-to-ssh-into-an-amazon-ec2-instance-permission-error

In windows you can go to the properties of the pem file, and go to the security tab, then to advance button.
remove inheritance and all the permissions. then grant yourself the full control. after all SSL will not give you the same error again.

需要将下载的.pem文件的安全属性更改为仅自己完全控制,其他成员的权限都要删掉。
在linux下,可以用

chmod 400 mykey.pem

在windows下,比较麻烦,步骤如下:

  1. 右键点击文件,选择“属性”->“安全”->“高级”
  2. 点击“禁用继承”按钮,将所有用户的访问权限删掉。
  3. 点击“添加”
    最后看起来像这个样子
    在这里插入图片描述

版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_42644062/article/details/102909228