首页 > 编程知识 正文

亚马逊云服务器安全,亚马逊云服务器如何设置

时间:2023-05-04 12:54:50 阅读:221479 作者:3975

申请的亚马逊云服务器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

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。