You can connect to a Linux Elastic Compute Service (ECS) instance by using a username and password from an on-premises device, such as a Windows, Linux, macOS, Android, or iOS device.
Prerequisites
A Linux instance is created.
A logon password is set for the instance. If you have not set a password for the instance or if you have forgotten the password, you must reset the password for the instance. For more information, see Reset the logon password of an instance.
A public IP address or an elastic IP address (EIP) is associated with the instance.
The instance is in the Running state.
The following rules are added to the security group to which the instance belongs. For more information, see Add a security group rule.
Network type
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
Internet
Use a username and password to connect to a Linux instance from a Windows device
This 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.
Download and install PuTTY.
Download link: PuTTY.
Start PuTTY.
Configure required parameters to connect to the Linux instance.
Host Name (or IP address): Specify the public IP address or EIP of the instance.
Port: Enter 22.
Connection type: Select SSH.
Saved Sessions: Enter a name that is easy to identify and click Save to save the session. This way, you do not need to enter session information, such as the public IP address of the instance, the next time you connect to the instance.
NoteTo prevent the PuTTY connection from closing due to timeout, we recommend that you click
to 60, which specifies 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.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.
NoteIf the PuTTY Security Alert message appears the next time you connect to the instance, the instance may suffer from man-in-the-middle attacks. For more information about alerts, see the official PuTTY documentation.
Enter the username and press Enter. The default username is root.
Enter the logon password for 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.If the error message
Disconnected:No supported authentication methods available
appears, username-password-based authentication is disabled in the instance or the public key of the key pair is not added to the.ssh/authorized_keys
file of the authenticating user. For more information, see What do I do if the error message "No supported authentication methods available (server sent: publickey,gssapi-keyex,gssapi-with-mic)" appears when I connect to a Linux instance by using a third-party SSH client?
Use a username and password to connect to a Linux instance from a Linux or macOS device
Run the following SSH command:
ssh root@<Public IP address or EIP of the instance>
Example command:
ssh root@47.99.XX.XX
Enter the logon password for the instance.
If the
Welcome to Alibaba Cloud Elastic Compute Service !
message appears, you are connected to the instance.
References
If you do not want to connect to a Linux instance by using a username and password from an on-premises device, you can log on to the Linux instance by using Workbench from the ECS console. For more information, see Connect to a Linux instance by using a password or key.