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

Prerequisites

  • You have created an instance.
  • You have set a logon password for the instance.
  • You have allocated a public IP address or an Elastic IP (EIP) address to the instance.
  • The instance is in the Running state.
  • You have added security group rules to the security group to which the instance belongs to allow access over the corresponding port. For more information, see Add security group rules.
    Network type NIC type Direction Authorization policy Protocol type Port range Priority Authorization type Authorization object
    VPC N/A Inbound Allow SSH (22) 22/22 1 IPv4 CIDR block 0.0.0.0/0
    Classic network Internet

Background information

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

Use a username and password for authentication on a Windows device

The following section uses PuTTY as an example to introduce how to use a username and password to connect to a Linux instance

  1. Download and install PuTTY.
    Download PuTTY from PuTTY.
  2. Start PuTTY.
  3. Configure the required parameters to connect to a Linux instance.
    • Host Name (or IP address): Specify the public IP address or EIP of the instance.
    • Port: Enter the port number 22.
    • Connection Type: Select SSH.
    • Saved Sessions: optional. Enter an identifiable name and click Save to save the session. Saved sessions store session information so you do not need to enter session information such as the public IP address when you log on to the instance again.Saved Session
  4. Click Open.
    When you connect to the instance for the first time, the message PuTTY Security Alert appears, indicating that PuTTY cannot confirm the authenticity of the remote server and can provide only the public key fingerprint of the server. Select Yes to indicate that you trust this server. PuTTY will add the public key fingerprint to the registry of the on-premises device.
    Note If the message PuTTY Security Alert appears again when you log on later, the instance may suffer man-in-the-middle attacks. For more information, visit PuTTY User Manual.
    PuTTY cannot confirm the authenticity of the remote server (instance)
  5. Specify the username (as root by default) and press the Enter key.
  6. Specify the logon password of the instance and press the Enter key.
    When you log on to the Linux instance, the password characters are not displayed as you type.
    If the message Welcome to Alibaba Cloud Elastic Compute Service ! appears, the connection to the instance is successful.

Use a username and password for authentication on a Linux or Mac OS X device

  1. Enter 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 message Welcome to Alibaba Cloud Elastic Compute Service ! appears, the connection to the instance is successful.

Use a username and password for authentication on an Android or iOS device

For more information, see Connect to a Linux instance from a mobile device.