This topic describes how to use a username and password to connect to a Linux Elastic Compute Service (ECS) instance from a Windows, Linux, Mac OS X, Android, or iOS device.

Prerequisites

  • A Linux instance is created.
  • A logon password is set for the instance.
  • A public IP address or an elastic IP address (EIP) is associated with the instance.
  • The instance is in the Running state.
  • Rules are added to the security group to which the instance belongs to allow access to the corresponding ports. For more information, see Add security group rules.
    Network type NIC type Direction Action Protocol type Port range Priority Authorization type Authorization object
    Virtual Private Cloud (VPC) N/A Inbound Allow SSH (22) 22/22 1 IPv4 CIDR block 0.0.0.0/0
    Classic network Public

Background information

You can use one of the following methods based on the operating system of your device to connect to a Linux instance with a username and password:

Use a username and password to connect to a Linux instance from a Windows device

The following section describes how to use a username and password to connect to a Linux instance from a Windows device. PuTTY is used in this example.

  1. Download and install PuTTY.
    Click PuTTY official website to download PuTTY.
  2. Start PuTTY.
  3. Configure required parameters to connect to the Linux instance.
    • Host Name (or IP address): Enter the public IP address or EIP of the instance.
    • Port: Enter 22.
    • Connection Type: Select SSH.
    • Saved Sessions: optional. Enter a name that is easy to identify and click Save to save the session. The next time you log on, the saved session information (such as the public IP address) is automatically entered. Saved Session
  4. Click Open.
    The first time you connect to the instance, the PuTTY Security Alert message appears. This message indicates that PuTTY cannot verify the authenticity of the remote server (instance) and provides only the public key fingerprint of the server instead. Click Yes to indicate that you trust this server. PuTTY then adds the public key fingerprint to the registry of your device.
    Note If the PuTTY Security Alert message appears the next time you log on to the instance, the instance may have suffered from man-in-the-middle attacks. For more information, see PuTTY User Manual.
    PuTTY cannot verify the authenticity of the remote server
  5. Enter the username (such as root, which is the default username) and press the Enter key.
  6. Enter the logon password of the instance and press the Enter key.
    The characters of the password are hidden while you are entering the password. After you enter the password, press the Enter key.
    If the Welcome to Alibaba Cloud Elastic Compute Service ! message appears, you are connected to the instance.

Use a username and password to connect to a Linux instance from a Linux or Mac OS X device

  1. Run the following SSH command:
    ssh root@<Public IP address or EIP of the instance>

    Example:

    ssh root@47.99.XX.XX
  2. Enter the logon password of the instance.
    If the Welcome to Alibaba Cloud Elastic Compute Service ! message appears, you are connected to the instance.