We have two methods to remotely connect to the Linux OS instance:
Method 1: Connect by using the Remote Connection function on the Console.
Method 2: Connect by using the local SSH client. (Linux OS)
Port 22 of the server’s firewall is enabled, and the corresponding SSH service is alive and monitored on the server.
The Remote Connection function has three entries:
The Card label on the Server List page
The upper-right corner on the Server Details page
The Remote Connection function of Server O&M
Prerequisites: You must download and installed PuTTY and PuTTYgen.
- PuTTY download address
- PuTTYgen download addressModify the root password, and then enter the IP address, account, and password, and connect by means of PuTTY.
(Optional) If you are using the .pem private key file generated by Alibaba Cloud, please convert the file into a .ppk private key file by referencing the following steps. If the private key file you are using is already a .ppk file, you can skip this section.
- Start PuTTYgen. In this example, the PuTTYgen version is 0.68.
- Choose Parameters > Type of key to generate, and select RSA. The value of Number of bits in a generated key can be left as is. The software will automatically update the value based on the imported private key information.
- Click Load. The PuTTYgen only displays files with a .ppk extension by default. To find your .pem file, select to display “All Files”.
Select the .pem private key file downloaded from Alibaba Cloud, and click Open.
Click OK to close the confirmation dialog box.
Click Save private key. PuTTYgen will display a warning about saving the key without a password. Click YES(Y).
Specify the same name for the private key as the key pair, and save the modification. PuTTY will automatically add the .ppk extension for the file.
Choose Connection > SSH > Auth, click Browse…, and then select the .ppk file generated in the previous step.
- Enter the account and the Internet IP address of the instance to be connected in Host Name (or IP address). The format is: “root@IP address”.
- Enter 22 in Port.
- Select SSH in Connection type.
Click Open to start connecting your Linux instance.
When the page shows Connection established., it indicates you have successfully logged on to the instance using the key pair.
Next, we will describe how to log on to a Linux instance by using an SSH key pair in a Linux environment or an environment that supports SSH commands (e.g. MobaXterm for Windows). The precondition is that you have already created a key pair on the console, and key pair management requires a server restart on console to become active.
Procedures are as follows:
Find the directory of your downloaded private key file, e.g.
xxx.pem is your private key file.
Use the following command to modify the attribute of your private key file:
chmod 400 xxx.pem.
Use an SSH command to connect to the instance (let’s assume the Internet IP is 10.10.10.100):
ssh email@example.com -i /root/xxx.pem.
After you have enabled a key, the server will disable the account-password logon method by default. If you want to use the account-password logon method, you must modify the configuration file.
Remote server logon.
PasswordAuthentication yes, and save the modification.
Enter the following command
sudo service sshd restartto restart the SSH service, then you will be able to connect to the server by using the account and password again.