This topic describes how to connect to a Linux server by using the Simple Application
Server console or by using a third-party client.
Background information
You can use the Simple Application Server console to connect to a server. For more
information, see Connect to a Linux server by using Workbench.
You can also use a third-party client to connect to a Linux server. The methods used
to connect to a Linux server vary based on the operating systems of your local device.
For more information, see the following topics:
Note that if key-based logon is enabled on a Linux server, password-based logon is
automatically disabled for the root
account on the server. To re-enable password-based logon, you must modify the configuration
file. For more information, see Re-enable password-based logon.
Connect to a Linux server by using Workbench
- Log on to the Simple Application Server console.
- In the left-side navigation pane, click Servers.
- Use one of the following methods to connect to a Linux server:
- On the Servers page, find the server to which you want to connect and click the
icon in the server card to connect to the server. 
- On the Servers page, click the card of the server to which you want to connect. In the upper-right
corner of the Overview page, click Connect.

- On the Servers page, click the card of the server to which you want to connect. In the left-side
navigation pane, choose . Then, click Connect.

- Optional: Use Workbench to manage files in a Linux server
Workbench provides a GUI for you to manage files in Linux servers in a visual manner.
You can use Workbench to view, add, delete, and modify files in Linux servers. You
can also use Workbench to upload and download files in Linux servers. For more information,
see
Use Workbench to manage files in a Linux instance.
Connect to a Linux server from a Windows device
This section describes how to use the following methods to connect to a Linux server
from a Windows device. In the examples, PuTTY and PuTTYgen are used.
Method 1: Connect to a Linux server by using the system account and password
This method is applicable to Linux servers with a configured logon password. For more
information, see Manage the password of a server.
- Download and install PuTTY on your Windows device.
- Start PuTTY.
- Configure the Linux server to which you want to connect.
Configure the following parameters:
- Host Name(or IP address): Enter the public IP address of the Linux server. Example:
121.40.XX.XX
.
- Port. Enter 22.
- Connection type: Select SSH.
- Optional:Saved Sessions: Enter a name that is easy to identify and click Save to save the session. The next time you log on to the server, the saved session information
such as the public IP address is automatically entered.

- 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.

- On the command line, enter
root
, which is the system account of the Linux server. Then, press the Enter key.
- On the command line, enter the logon password that corresponds to the root account
of the Linux server and press the Enter key.
Note When you enter a password, no command output is returned to maximize data security.
You need only to enter the correct password and then press the Enter key.
A welcome page similar to the following figure indicates that you are logged on to
the server.

Method 2: Connect to a Linux server by using a key pair
This method is applicable to Linux servers with a bound key pair. For more information,
see Create a key pair.
- Convert the format of a private key file.
If the key file bound to your Linux server is automatically generated by Alibaba Cloud
in the .pem format, you must convert the key file from the .pem format to the .ppk format before you can use PuTTY to connect to the server. Perform the following operations:
- Download PuTTYgen to your Windows device.
- Start 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.
- Find and select the private key file stored in the .pem format on your local device. In the PuTTYgen Notice message, click Yes.
- In the Parameters section, select RSA.
- In the Actions section, click Save private key. Then, click Yes.
Specify a name for the private key file in the .ppk format and a path to which to save the file.
- Download and install PuTTY on your Windows device.
- Start PuTTY.
- Configure the Linux server to which you want to connect.
Configure the following parameters:
- Host Name(or IP address): Enter the public IP address of the Linux server. Example:
121.40.XX.XX
.
- Port. Enter 22.
- Connection type: Select SSH.
- Optional:Saved Sessions: Enter a name that is easy to identify and click Save to save the session. The next time you log on to the server, the saved session information
such as the public IP address is automatically entered.

- In the left-side navigation pane, choose .
- In the Authentication parameters section, click Browse...
- Select the key file in the .ppk format on your local device, and then click Open.
- 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.

- On the command line, enter
root
, which is the system account of the Linux server. Then, press the Enter key. A welcome page similar to the following figure indicates that you are logged on to
the server.

Connect to a Linux server from a Linux or macOS device
This section describes two methods that are used to connect to a Linux server. In
the examples, the operating systems that support SSH commands are used.
- Method 1: Connect to a Linux server by using the system account and password
This method is applicable to Linux servers with a configured logon password. For more
information, see Manage the password of a server.
- Run the following command to connect to a Linux server:
ssh root@<public IP address of the Linux server>
Sample command:ssh root@121.40.XX.XX
- Enter
yes
and press the Enter key.
The first time you connect to the Linux server, the system cannot independently verify
the authenticity of the server. The system instead provides you with the public key
fingerprint of the server and asks you to confirm whether to continue with the connection.
Enter yes
to indicate that you trust the server.
- Enter the logon password that corresponds to the root account of the Linux server
and press the Enter key.
Note When you enter a password, no command output is returned to maximize data security.
You need only to enter the correct password and then press the Enter key.
- Method 2: Connect to a Linux server by using a key pair
This method is applicable to Linux servers with a bound key pair. For information
about how to create a key pair for a server, see Create a key pair.
- Find the private key file stored on your local device.
In this example, /test/XXX.pem key file is used.
- Run the following command to modify permissions on the private key file.
Replace /test/XXX.pem with the actual path of the private key file.
chmod 400 /test/XXX.pem
- Run the following command to connect to the Linux server.
Replace <public IP address of the Linux server> and /test/XXX.pem with the actual public IP address of the Linux server and the actual path of the
private key file.
ssh root@<public IP address of the Linux server> -i /test/XXX.pem
Re-enable password-based logon
After you create a key pair for a simple application server and restart the server
for the new key pair to take effect, password-based logon is automatically disabled
for the root
account on the server. To re-enable password-based logon, you must modify the configuration
file of the server. Perform the following operations:
- Connect to the server by using the Simple Application Server console.
- Run the following command to open the /etc/ssh/sshd_config file:
- Press the I key to enter the edit mode. At the end of the file, change
PasswordAuthentication no
to PasswordAuthentication yes
. The following figure shows the modified configurations.

- Press the Esc key to exit the edit mode. Then, enter
:wq
and press the Enter key to save and close the file.
- Run the following command to restart the SSH service:
sudo service sshd restart
After SSH is restarted, you can use the root
account and its password to connect to the Linux server.