如何登录ec2机? [英] how to login to ec2 machine?
问题描述
为我提供了有关EC2机器的一些登录信息,基本上是ec2-XXX.compute-X.amazonaws.com以及用户名和密码。
I was given some login information for an EC2 machine, basically an ec2-X-X-X.compute-X.amazonaws.com plus a username and password.
怎么办我可以访问机器吗?我尝试过sshing:
How do I access the machine? I tried sshing:
ssh username@ec2-XXX.compute-X.amazonaws.com
,但是我收到权限被拒绝,请重试。
输入密码时。用正确的方法访问EC2计算机吗? (我发现的Google命中建议您可以使用ssh进入计算机,但它们也使用密钥对。)还是更有可能是因为我获得了无效的登录凭据而导致问题出现?
but I get a Permission denied, please try again.
when I enter the password. Is sshing the right way to access the EC2 machine? (Google hits I found suggested that you could ssh into the machine, but they also used keypairs.) Or is it more likely that the problem is that I was given invalid login credentials?
推荐答案
如果您是AWS的新用户,并且需要通过ssh访问全新的EC2实例,请记住,您还还需要允许传入流量端口22。
If you are new to AWS and need to access a brand new EC2 instance via ssh, keep in mind that you also need to allow incoming traffic on port 22.
假设创建的EC2实例接受所有默认的向导建议,则默认值将保护对计算机的访问
安全组,它基本上禁止所有入站流量。因此:
Assuming that the EC2 instance was created accepting all the default wizard suggestions, access to the machine will be guarded by the default
security group, which basically prohibits all inbound traffic. Thus:
- 转到AWS控制台
- 选择
安全组
在左侧导航窗格上 - 从主窗格中选择
default
(它可能是列表) - 在底部窗格中,选择
入站
,然后创建新规则
:SSH
- 点击
添加规则
,然后点击应用规则更改
- Go to the AWS console
- Choose
Security Groups
on the left navigation pane - Choose
default
from the main pane (it may be the only item in the list) - In the bottom pane, choose
Inbound
, thenCreate a new rule
:SSH
- Click
Add rule
and thenApply Rule Changes
接下来,假设您拥有私钥,请执行
Next, assuming that you are in possession of the private key, do the following:
$ chmod 600 path/to/mykey.pem
$ ssh -i path/to/mykey.pem root@ec2-X-X-X.compute-X.amazonaws.com
我的EC2实例是从Ubuntu 32位12.04映像,其配置不允许ssh访问root,并要求您以 ubuntu
的身份登录:
My EC2 instance was created from a Ubuntu 32-bit 12.04 image, whose configuration does not allow ssh access to root, and asks you to log in as ubuntu
instead:
$ ssh -i path/to/mykey.pem ubuntu@ec2-X-X-X.compute-X.amazonaws.com
干杯,
朱塞佩
Cheers, Giuseppe
这篇关于如何登录ec2机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!