Connect to a Linux instance by using a password

Last Updated: May 04, 2018

You can connect to a Linux instance by using different authentication methods:

This article describes how to connect to a Linux instance by using a password from software applications or command lines.

Prerequisites

Before you begin, make sure the following:

  • The instance is in the Running status. If not, start it.

  • You have set a logon password for the instance. If the password is lost, reset the password.

  • The instance can access Internet:

    • In a VPC, a public IP address is assigned to the instance or an EIP address is bound to the instance.
    • In the classic network, a public IP address is assigned to the instance by using either of the following methods:
      • For a Subscription or a Pay-As-You-Go instance, you can select Assign public IP when creating the instance.
      • For a Subscription instance without public IP address, you can assign one by upgrading bandwidth.
  • The following security group rules must be added to the security group that the instance joins. For more information, see Add a security group rule.
    Network type NIC Rule Direction Authorization Policy Protocol Type Port Range Authorization Type Authorization Object Priority
    VPC N/A Inbound Allow SSH(22) 22/22 Address Field Access 0.0.0.0/0 1
    Classic Internet

Procedure

Based on the operating system of your local machine, you have various options to connect to a Linux instance by using the SSH protocol:

Windows OS

If your local machine is running Windows OS, you can use a remote connection tool, such as PuTTY, to connect to a Linux instance. In this article, we use PuTTY as an example to describe how to connect to a Linux instance by using the password authentication method. Before you start, download PuTTY.

Follow these steps:

  1. Start putty.exe.

  2. In the left-side navigation pane, click Session, and configure the following parameters:

    • Host Name: Type the public IP address or EIP address of the instance.
    • Port: Type 22.
    • Connection Type: Select SSH.
    • Saved Session: Optional. If you do not want to repeat the configurations during the next logon, add a name for the session, and click Save.
      Configure Session
  3. Click Open to connect, and in the PuTTY Security Alert dialog box, click Yes.

    Note: For the first connection to an ECS instance, you have the PuTTY Security Alert as follows, which means PuTTY cannot guarantee the instance is the one that you think it is, so it can only provide the public key fingerprint of the instance for you to decide to trust the instance or not. If you select Yes, the public key will be added to the PuTTY’s cache and you will not be alerted again during your next connection. If you select Yes but are alerted again, a man-in-the-middle attack (MITM) may occur. For more information, see PuTTY User Manual.
    PuTTY Security Alert

  4. As prompted, type the username and password for the Linux instance, and press the Enter key.

    Note: The password is not displayed on screen.

When you see the following message, you have successfully connected to an instance.

  1. Welcome to Alibaba Cloud Elastic Compute Service !

Linux or Mac OS X

If your local machine is running Linux OS or Mac OS X, follow these steps:

  1. Run the command ssh root@[Public IP address or EIP address of the instance].

  2. Type the password and press the Enter key.

When you see the following message, you have successfully connected to an instance.

  1. Welcome to Alibaba Cloud Elastic Compute Service !

Android or iOS

If your local machine is running Android OS or iOS, you can use various apps to connect to a Linux instance. For more information, see Connect to an instance on a mobile device.

Reference

You can run a script to install a graphical desktop on an instance running CentOS. For more information, see Automatic installation tool for Linux instance.

Thank you! We've received your feedback.