You can connect to a Linux server remotely by using Workbench, third-party clients such as PuTTY, or SSH commands. This topic describes how to connect to a Linux server.
Prerequisites
The Linux server is in the Running state.
If you want to use a password, make sure that you have set a password for the server, and key pair-based logon is disabled.
If key pair-based logon is enabled, you need to re-enable password-based logon. For more information, see Q1: I used a key pair to logon previously. How can I use a password to log on?
Method 1: Use Workbench to connect (recommended)
Workbench is a browser-based remote connection tool that allows direct server access without the need for additional software. For more information about Workbench, see Basic operations in Workbench.
Go to the Servers page in the Simple Application Server console.
Click Remote Connection in server card. In the Remote Connection dialog box, select a connection method.
One-click logon using Workbench
In the Connect with One-click on Workbench section, click Log on Now to connect to the server as
admin
user. You do not need to enter a username or password.Password-based logons on Workbench
Find Password-based Logons on Workbench under Log on by Using Other Methods. Click Log on Now, and then enter the password of
root
to connect.
Method 2: Use PuTTY to connect from Windows
Connect by using a password
Download and install PuTTY on your Windows device.
Start PuTTY and configure the information.
The following table describes the parameters. Use the default values for other parameters.
Parameter
Description
Host Name(or IP address)
Enter the logon account and public IP address of the server. Format: Username@Public IP Address. Example:
root@121.40.XX.XX
.Port
22.
Connection type
Select SSH.
Saved Sessions
Enter a name to identify, such as "test". Then, click Save to save the session. You do not need to enter them again on your next logon.
Click Open. In the command line, enter Linux system user
root
. Then press theEnter
key.In the command line, enter the logon password of the Linux server. Then press
Enter
.NoteFor data security, no output is displayed. You only need to enter the correct password and press Enter.
Your logon is successful if following information is displayed.
Connect by using a key pair
You have bound a key pair to the server. For more information, see Create or import a key pair.
ImportantAfter you create a key pair, you need to restart the server to allow the key pair to take effect.
Convert the
.pem
private key file to the.ppk
private key file.You need convert the key file from the
.pem
format to the.ppk
format, if the key file is in.pem
format from Alibaba Cloud. Then you can use PuTTY to connect to the server. Perform the following steps:Open PuTTYgen. In the Actions section, click Load.
In the lower part of the Load private key dialog box, select All Files(*.*) to view files of all formats.
In the PuTTYgen Notice dialog box, find and select the private key file in the
.pem
format, then click Yes.In Parameters section, click RSA.
In Actions section, click Save private key, then click Yes(Y).
Specify a name and a path for the private key file in the
.ppk
format.
Configure the information for connection.
The following table describes the parameters. Use the default values for other parameters.
Parameter
Description
Host Name(or IP address)
Enter the logon account and public IP address of the server. Format: Username@Public IP Address. Example:
root@121.40.XX.XX
.Port
22.
Connection type
Select SSH.
Saved Sessions
Enter a name to identify, such as "test". Then, click Save to save the session. You do not need to enter them again on your next logon.
Configure the private key file for authentication.
In the left-side navigation pane, choose Connection > SSH > Auth > Credentials.
In the Private key file for authentication section, click Browse….
Select the key file in the
.ppk
format, and click Open.
Click Open.
Your logon is successful if following information is displayed.
Method 3: Use SSH commands to connect from Linux or macOS
Connect using a password
Connect to the Linux server.
ssh root@<Public IP address of the Linux server>
Example:
ssh root@121.40.XX.XX
Enter
yes
and pressEnter
.At the first-time connection, the system cannot verify the authenticity of the remote server. So the system provides only the public key fingerprint of the server, and ask you whether to continue with the connection. Enter
yes
to indicate that your trust.Enter the logon password of the Linux server and press
Enter
.NoteFor data security purposes, no output is returned when you enter a password. You need only to enter the correct password and then press the Enter key.
Connect using a key pair
You have bound a key pair to the server. For more information, see Create or import a key pair.
ImportantAfter you create a key pair, you need to restart the server to allow the key pair to take effect.
Find the private key file stored on your device.
In this example, it is
/test/XXX.pem
.Modify permissions on the private key file.
Replace
/test/XXX.pem
with the actual path of the key file.chmod 400 /test/XXX.pem
Connect to the Linux server.
Replace
<Public IP address of the Linux server>
and/test/XXX.pem
with the actual information.ssh root@<Public IP address of the Linux server> -i /test/XXX.pem
If you see the following information, run
ssh -o PubkeyAcceptedKeyTypes=+ssh-rsa root@<Public IP address of the Linux server> -i /test/XXX.pem
.sign_and_send_pubkey: no mutual signature supported root@47.110.XX.XX: Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
Method 4: Use rescue logon to connect
When you cannot connect to a server using Workbench or third-party remote connection tools such as PuTTY, Xshell, or SecureCRT, you can use the rescue logon (VNC) to connect to the server for troubleshooting.
A rescue connection session lasts for about 300 seconds by default. If you do not perform any operations more than 300 seconds, the connection automatically closes and displays a blank screen. In this case, you need to close the current rescue connection page and reconnect using the rescue feature.
Go to the Servers page in the Simple Application Server console.
In the server card, click Connect.
In the Connect dialog box, in the Rescue Logon section, click Log on Now.
You will be directed to the rescue logon page. If you are not directed to this page, check whether your browser is blocking pop-up dialogs.
Enter the logon user (such as root) and press
Enter
.Enter the logon password and press
Enter
.NoteFor security issues, the characters of the password are hidden. Make sure that you enter the correct password.
If you need to copy a long text from your device to the server, such as a file download URL, you can click Copy Command in the upper-right corner of the rescue page, and paste the command in the pop-up dialog box.
Your logon is successful if following information is displayed.
FAQ
Q1: I used a key pair to logon previously. How can I use a password to log on?
Q2: Why can't I connect to a server by using the rescue logon?
For information about how to troubleshoot problem such as a timeout or failure, see FAQ about remote connection. If the issue persists, you can submit a ticket for technical support.
References
Use Alibaba Cloud Client to connect to a server
You can install Alibaba Cloud Client on your on-premises computer to connect to a server.
Set a custom port to connect to a server
The default remote connection port for a Linux server is
22
. To improve security, you can modify the default remote connection port.