当前位置:   article > 正文

aws ec2 ssh连接_aws ssh连接

aws ssh连接

在界面创建好ec2,选择aws linux, 并创建了pairKey。
回到自己的终端,输入:

ssh -i ~/Downloads/udemy22Test.pem  ec2-user@ec2-34-221-234-36.us-west-2.compute.amazonaws.com 
  • 1

因为pairKey udemy22Test.pem 位于Download文件夹下,所以需要这个路径。
但是爆警告:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/Users/sylvia/Downloads/udemyTest.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/sylvia/Downloads/udemyTest.pem": bad permissions
ec2-user@ec2-34-221-234-36.us-west-2.compute.amazonaws.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

所以需要修改权限:这里我先挪动文件到当前文件夹,然后查看文件权限,再修改pairKey文件的权限为只读,即400(https://chmod-calculator.com/),然后就可以连接上了。

mv ~/Downloads/udemyTest.pem ./  
ls -l udemyTest.pem 
chmod 400 udemy22Test.pem 
ssh -i "udemy22Test.pem" ec2-user@ec2-34-221-234-36.us-west-2.compute.amazonaws.com
  • 1
  • 2
  • 3
  • 4
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/807239
推荐阅读
相关标签
  

闽ICP备14008679号