how to login to ec2 machine?

前端 未结 5 1598
借酒劲吻你
借酒劲吻你 2021-01-30 21:03

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.

How do I access the machine? I tried

5条回答
  •  自闭症患者
    2021-01-30 21:50

    The process of connecting to an AWS EC2 Linux instance via SSH is covered step-by-step (including the points mentioned below) in this video.

    To correct this particular issue with SSH-ing to your EC2 instance:

    1. The ssh command you ran is not in the correct format. It should be:

      ssh -i /path/my-key-pair.pem ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com
      
    2. Note, you need access to the private key (.pem) file to use in the command above. AWS prompts you to download this file when you first launch your instance. You will need to run the following command to ensure that only your root user has read-access to it:

      chmod 400 /path/to/yourKeyFile.pem
      
    3. Depending on your Linux distribution, the user you need to specify when you run ssh may be one of the following:

      • For Amazon Linux, the user name is ec2-user.
      • For RHEL, the user name is ec2-user or root.
      • For Ubuntu, the user name is ubuntu or root.
      • For Centos, the user name is centos.
      • For Fedora, the user name is ec2-user.
      • For SUSE, the user name is ec2-user or root.
      • Otherwise, if ec2-user and root don't work, check with your AMI provider.
    4. You need to enable an inbound SSH firewall. This can be done under the Security Groups section of AWS. Full details for this piece can be found here.

提交回复
热议问题