Log in with SSH Keys
<p><strong>Prerequisites</strong></p>
<p>1.You have successfully created an ECS instance. For more information, see Create a Linux Instance.</p>
<p>2.You have downloaded keys.</p>
<p>3.Private key adopts the format of PKCS#8 of unencrypted PEM (Privacy-enhanced Electronic Mail) code.</p>
<p><strong>Usage Guidelines</strong></p>
<p>Keys can only be downloaded for once. Keep it properly. If it needs to be downloaded again, the keys should be unbound to the instance and generated again.</p>
<p><strong>Windows OS as Client</strong></p>
<p><strong>Example 1: Take PuTTY as an example to connect</strong></p>
<p><strong>Procedures</strong></p>
<p><strong>1. </strong><strong>Create Keys.</strong></p>
<p>(1) Log in to the ECS Console.</p>
<p>(2) In the left navigation pane, click <strong>Keys</strong> to enter the <strong>Keys</strong> page.</p>
<p>(3) In the upper right corner, click <strong>Create</strong> to enter the dialog box of <strong>Create Key</strong> that opens.</p>
<p>(4) Enter Description, select <strong>Create Way</strong>, and click <strong>Confirm</strong>.</p>
<p>(5) Your local computer will download the key of .pem format.</p>
<p><strong>Note:</strong></p>
<ul>
<li>After you click <strong>Confirm</strong>, private keys will be immediately downloaded to local and not stored in Ping An Cloud. It cannot be downloaded again. Keep it properly.</li>
<li>When keys are bound to an ECS instance, you cannot log in to the ECS instance without private keys nor with use name and password.</li>
</ul>
<p><strong>2. </strong><strong>Keys Bind to an Instance</strong></p>
<p>(1) Log in to the ECS Console.</p>
<p>(2) In the left navigation pane, click <strong>Keys</strong> to enter the <strong>Keys</strong> page.</p>
<p>(3) In the operation column of the target key, click <strong>Binding</strong> to enter the dialog box of <strong>Binding</strong> that opens.</p>
<p>(4) Select target instance, and click <strong>Confirm</strong>.</p>
<p>(5) In the dialog box of <strong>Verification Code </strong>that opens, enter the verification code and click <strong>Confirm</strong>.</p>
<p><strong>3. </strong><strong>Convert Key Format</strong></p>
<p>(1) Double-click PuTTYgen.</p>
<p>(2) In <strong>Actions</strong> area, click <strong>Load</strong> to import the generated keys file, and select <strong>All files (*.*)</strong> as the importing format.</p>
<p>(3) Click <strong>Save private key</strong>.</p>
<p>(4) In the <strong>Alert</strong> dialog that opens, select the path where you store the key, and enter <strong>key name.ppk</strong> after the file name. For example, save the private key file EC-YD60002.pem as EC-YD60002.ppk.</p>
<p><strong>4. </strong><strong>Connect to a Linux instance </strong></p>
<p>(1) Double-click PuTTY software.</p>
<p>(2) Click <strong>Connection > SSH > Auth</strong>.</p>
<p>(3) Click <strong>Browse,</strong> and select storage path of key in the dialog box that opens.</p>
<p>(4) Select target key, click <strong>Open</strong>, and upload .ppk private key that is to be converted.</p>
<p>(5) Click <strong>Session,</strong> and configure the following information:</p>
<ul>
<li> Host Name (or IP address): Enter the Internet IP address of the ECS instance.</li>
<li>Connection type: SSH is selected by default.</li>
<li>Saved Session (optional): You can enter a name that is easy to recognize. Click <strong>Save</strong>, so that next time you can enter the login page without entering information again.</li>
</ul>
<p>(6) Click <strong>Open</strong>.</p>
<p><strong>5. </strong>Verification is succeeded, and you can log in to the Linux instance.</p>
<p><strong>Example 2: Take Xshell as an example to connect</strong></p>
<p><strong>Procedures</strong></p>
<p>1. Double-click Xshell.</p>
<p>2. Click <strong>Tools > User Key Manager (U)</strong>.</p>
<p>3. In the dialog box of <strong>User Key</strong> that opens, select pem file that is saved before, and click <strong>Import</strong>.</p>
<p>4. Create new connection. Enter name, protocol, host (ip), and port No. 22 in <strong>Connection</strong> area.</p>
<p>5. Click <strong>User Identity Authentication</strong>, and configure the following information:</p>
<ul>
<li>Method (M): Select Public Key.</li>
<li>Username (U): Enter root.</li>
<li>User key (K): Select pem key to be imported.</li>
</ul>
<p>6. In the dialog box of <strong>SSH Security Alert</strong> that opens, click <strong>Accept & Save</strong>.</p>
<p><strong>Linux OS as Client</strong></p>
<p>If your client is Linux operating system, you can execute the following command:</p>
<p>1. Change permission and authorize private key with permission of owner read-only.</p>
<p>chmod 400 <storage path of private key that is associated with ECS></p>
<p>For example, chmod 400 /Downloads/ EC-YD60002.pem</p>
<p>2. Remotely log in by executing the following command.</p>
<p>ssh -i <storage path of private key that is associated with ECS> root@< IP address></p>
<p>For example, ssh -i /Downloads/ EC-YD60002.pem root@101.xxx.xxx.xxx</p>
Did the above content solve your problem?
Yes
No
Submitted successfully! Thank you for your feedback, we will try our best to do better and better!