This document describes how to use a SSH key to log in to a Linux instance from a local Linux, Mac OS or Windows.
Linux, Mac OS or Windows (including Windows 10 and Windows Server 2019)
Password or Key
Note:
If your local computer uses Mac OS, you must open the terminal provided by the system and then execute the following command.
If your local computer uses Linux, you can directly execute the following command.
If your local computer uses Windows 10 or Windows Server 2019, you must first open the command prompt CMD and then execute the following command.
ssh <username>@<hostname or IP address>
username
refers to the default account name obtained as a prerequisite.hostname or IP address
refers to the public IP address or custom domain name of your Linux instance.
Execute the following command to set the private key file readable only to you.
chmod 400 <The absolute path of the private key downloaded to be associated with the CVM>
icacls <The absolute path of the private key downloaded to be associated with the CVM> /grant <Windows user account>:F
icacls <The absolute path of the private key downloaded to be associated with the CVM> /inheritancelevel:r
Execute the following command for remote login.
ssh -i <The absolute path of the private key downloaded to be associated with the CVM> <username>@<hostname or IP address>
username
refers to the default account name obtained as a prerequisite.hostname or IP address
refers to the public IP address or custom domain name of your Linux instance.For example, execute the ssh -i "Mac/Downloads/shawn_qcloud_stable.pem" ubuntu@192.168.11.123
command to remotely log in to the Linux CVM.
After logging in to the CVM, you can build a personal website or forum or perform other operations. For more information, please see:
Was this page helpful?