EC2实例ssh连接报错

2023-12-26 15:22:53

1. 本地连接aws的ec2实例,出现如下报错

$ ssh -i dev-use.pem ec2-user@10.0.134.235                 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/Users/jack/.ssh/dev-eks-use.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 "/Users/jack/.ssh/dev-eks-use.pem": bad permissions
ec2-user@10.0.134.235: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

2. 解决方法

$ chmod 400 dev-use.pem

3. 再次连接成功

$ ssh -i dev-use.pem ec2-user@10.0.134.235   

A newer release of "Amazon Linux" is available.
  Version 2023.1.20230719:
  Version 2023.1.20230725:
  Version 2023.1.20230809:
  Version 2023.1.20230825:
  Version 2023.1.20230906:
  Version 2023.1.20230912:
  Version 2023.2.20230920:
  Version 2023.2.20231002:
  Version 2023.2.20231011:
  Version 2023.2.20231016:
  Version 2023.2.20231018:
  Version 2023.2.20231026:
  Version 2023.2.20231030:
  Version 2023.2.20231113:
  Version 2023.3.20231211:
  Version 2023.3.20231218:
Run "/usr/bin/dnf check-release-update" for full release and version update info
   ,     #_
   ~\_  ####_        Amazon Linux 2023
  ~~  \_#####\
  ~~     \###|
  ~~       \#/ ___   https://aws.amazon.com/linux/amazon-linux-2023
   ~~       V~' '->
    ~~~         /
      ~~._.   _/
         _/ _/
       _/m/'
Last login: Mon Dec 25 03:30:15 2023 from 10.0.134.235  
[ec2-user@ip-10-0-134-235 ~]$

文章来源:https://blog.csdn.net/ma_qi_chao/article/details/135206619
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。