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.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </strong><strong>Create Keys.</strong></p> <p>(1)&nbsp;&nbsp;&nbsp; Log in to the ECS Console.</p> <p>(2)&nbsp;&nbsp;&nbsp; In the left navigation pane, click <strong>Keys</strong> to enter the <strong>Keys</strong> page.</p> <p>(3)&nbsp;&nbsp;&nbsp; In the upper right corner, click <strong>Create</strong> to enter the dialog box of <strong>Create Key</strong> that opens.</p> <p>(4)&nbsp;&nbsp;&nbsp; Enter Description, select <strong>Create Way</strong>, and click <strong>Confirm</strong>.</p> <p>(5)&nbsp;&nbsp;&nbsp; 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.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </strong><strong>Keys Bind to an Instance</strong></p> <p>(1)&nbsp;&nbsp;&nbsp; Log in to the ECS Console.</p> <p>(2)&nbsp;&nbsp;&nbsp; In the left navigation pane, click <strong>Keys</strong> to enter the <strong>Keys</strong> page.</p> <p>(3)&nbsp;&nbsp;&nbsp; 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)&nbsp;&nbsp;&nbsp; Select target instance, and click <strong>Confirm</strong>.</p> <p>(5)&nbsp;&nbsp;&nbsp; In the dialog box of <strong>Verification Code </strong>that opens, enter the verification code and click <strong>Confirm</strong>.</p> <p><strong>3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </strong><strong>Convert Key Format</strong></p> <p>(1)&nbsp;&nbsp;&nbsp; Double-click PuTTYgen.</p> <p>(2)&nbsp;&nbsp;&nbsp; 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)&nbsp;&nbsp;&nbsp; Click <strong>Save private key</strong>.</p> <p>(4)&nbsp;&nbsp;&nbsp; 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.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </strong><strong>Connect to a Linux instance </strong></p> <p>(1)&nbsp;&nbsp;&nbsp; Double-click PuTTY software.</p> <p>(2)&nbsp;&nbsp;&nbsp; Click <strong>Connection &gt; SSH &gt; Auth</strong>.</p> <p>(3)&nbsp;&nbsp;&nbsp; Click <strong>Browse,</strong> and select storage path of key in the dialog box that opens.</p> <p>(4)&nbsp;&nbsp;&nbsp; Select target key, click <strong>Open</strong>, and upload .ppk private key that is to be converted.</p> <p>(5)&nbsp;&nbsp;&nbsp; Click <strong>Session,</strong> and configure the following information:</p> <ul> <li>&nbsp;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)&nbsp;&nbsp;&nbsp; Click <strong>Open</strong>.</p> <p><strong>5.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Double-click Xshell.</p> <p>2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Click <strong>Tools &gt; User Key Manager (U)</strong>.</p> <p>3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Create new connection. Enter name, protocol, host (ip), and port No. 22 in <strong>Connection</strong> area.</p> <p>5.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In the dialog box of <strong>SSH Security Alert</strong> that opens, click <strong>Accept &amp; 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.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Change permission and authorize private key with permission of owner read-only.</p> <p>chmod 400 &lt;storage path of private key that is associated with ECS&gt;</p> <p>For example, chmod 400 /Downloads/ EC-YD60002.pem</p> <p>2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Remotely log in by executing the following command.</p> <p>ssh -i &lt;storage path of private key that is associated with ECS&gt; root@&lt; IP address&gt;</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
Please complete information!

Call us

400-151-8800

Email us

cloud@pingan.com

Online customer service

Instant reply

Technical Support

cloud products