如何通过 SSH 连接到 Redhat EC2 实例?

How can I SSH into a Redhat EC2 instance?

我读过 AWS docs 里面说我应该使用:

ssh -i /path/my-key-pair.pem my-instance-user-name@my-instance-public-dns-name

但我不知道 my-instance-user-name 应该是什么。


对于Ubuntu我总是

ssh -i /path/my-key-pair.pem ubuntu@my-instance-public-dns-name

通过 chmod 400 /path/my-key-pair.pem

更改我的密钥的权限后

对于红帽 (RHEL) it will be ec2-user. For other OS, the list is here:

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

  • For a CentOS AMI, the user name is centos or ec2-user.

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

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

  • 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.

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

  • For a Bitnami AMI, the user name is bitnami.

  • Otherwise, check with the AMI provider.