This topic describes how to use a username and password to connect to an Elastic Compute Service (ECS) Linux 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 Linux instance to which you want to connect 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 a security group rule.
    Network type Network interface controller (NIC) type Rule 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 blocks 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. In this example, PuTTY is used.

  1. Download and install PuTTY.
    Download link: PuTTY.
  2. Start PuTTY.
  3. Configure required parameters to connect to the Linux instance.
    • Host Name (or IP address): Specify the static public IP address of the instance or the EIP associated with the instance.
    • Port: Enter 22.
    • Connection type: Select SSH.
    • Saved Sessions: optional. Enter a name that helps you identify the session and click Save to save the session. This way, you do not need to enter session information such as the public IP address when you connect to the instance again. Saved Session
    Note To prevent the PuTTY connection from closing due to timeout, we recommend that you click Connection in the Category section and set Seconds between keepalives (0 to turn off) to 60, which indicates that the server sends a message to the client every 60 seconds (equivalent to 1 minute) to maintain the connection. The default value of Seconds between keepalives (0 to turn off) is 0.
  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 can provide 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 connect 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 and press Enter. The default username is root.
  6. Enter the logon password of the instance and press the Enter key.
    The characters of the password are hidden when you enter 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.