Ubuntu Server 的 Amazon AMI 映像的默认用户名是什么?

Dav*_*rks 34 server login amazon-ec2

我刚刚在 Amazon EC2 上启动了 Ubuntu Server AMI 之一。

我连接得很好,但我没有看到任何告诉我默认登录凭据的信息。

login as: ?
Run Code Online (Sandbox Code Playgroud)

Mar*_*ell 37

在 EC2 上,所有 Ubuntu AMI 都应该像这样连接:

$ ssh -i your-ssh-key.pem ubuntu@external.dns.name

因此,您使用在启动时注入实例的 ssh 密钥(不是密码)以“ubuntu”用户的身份进行连接。通过身份验证后,您可以使用 sudo 发出无密码的 root 命令。

(注意:您的 ssh 密钥可能是 .priv,或 .pem,或者没有扩展名,这只是一个例子)

这里还有一些关于连接到 EC2 实例的方便资源:

启动实例并选择或创建新的 SSH 密钥对:http ://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/index.html? LaunchInstance.html

连接您的 ssh 密钥对:http ://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/index.html? ConnectToInstanceLinux.html

他们没有提到的是,您使用“ubuntu”帐户而不是 root 连接到 Ubuntu 实例。


Eri*_*ond 8

额外提示:

  1. 我更喜欢输入ssh ubuntu@host而不是ssh -i your-ssh-key.pem ubuntu@host.

    我写了一篇文章,描述了如何做到这一点:

    将个人 ssh 密钥上传到 Amazon EC2
    http://alestic.com/2010/10/ec2-ssh-keys

  2. 如果您始终使用 登录 EC2 主机,ubuntu您甚至可以将其设为使用标准 EC2 实例公共主机名时的默认值。这让您只需键入ssh hostname. 为此,请编辑$HOME/.ssh/config并添加一个部分,例如:

    Host *.amazonaws.com
      User ubuntu
    
    Run Code Online (Sandbox Code Playgroud)