aws ec2 ssh连接

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

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

因为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).

所以需要修改权限:这里我先挪动文件到当前文件夹,然后查看文件权限,再修改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
  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值