mac 登录亚马逊云服务器报错:Permission denied (publickey).

申请的亚马逊云服务器EC2,实例为ubuntu系统

一、打开终端,定位到放置密钥的文件夹;

二、确保私有秘钥不是公开可见的:

chmod 400 密钥文件名.pem

三、两种方式连接云服务器:(假设实例的对公IP为:11.22.33.44)

ssh -i 密钥文件名.pem ec2-user@11.22.33.44

ssh -i 密钥文件名.pem ec2-user@ec2-11-22-33-44.us-east-2.compute.amazonaws.com

两种方式均报错:

Permission denied (publickey).

四、解决方法:

在亚马逊官方文档中有下面一段:

Get the default user name for the AMI that you used to launch your instance

  • For an Amazon Linux AMI, the user name is ec2-user.

  • For a Centos AMI, the user name is centos.

  • For a Debian AMI, the user name is admin or root.

  • For a Fedora AMI, the user name is ec2-user or fedora.

  • For a RHEL AMI, the user name is ec2-user or root.

  • For a SUSE AMI, the user name is ec2-user or root.

  • For an Ubuntu AMI, the user name is ubuntu or root.

  • Otherwise, if ec2-user and root don't work, check with the AMI provider.

最后一条说明存在使用ec2-user和root不能连接的情况,所以需要多尝试一下,由于我装的是ubuntu系统,直接将连接命令中的ec2-user换成ubuntu,完美连接。

 

转载于:https://www.cnblogs.com/wendaobiancheng/p/9042425.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值