我已阅读 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
更改我的 key 的权限后
最佳答案
对于红帽 (RHEL) it will be ec2-用户
。对于其他操作系统,列表为 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.
关于amazon-web-services - 如何通过 SSH 连接到 Redhat EC2 实例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69703353/