SupportConsole
Tickets
Navigation

Getting Started
Registration and Account SetupFirst Order: From Registration to Power-OnConsole Navigation and Common Entry PointsGetting Started: Terms and Concepts
Cloud Server Operations
Connection and Login: SSH Key, Password, VNC / noVNCUnable to Connect and Self-Service Outage TroubleshootingPower On, Shutdown, and RestartSystem Reinstallation, Public Images, and Custom ISOSnapshots and BackupsDisk Configuration and ResizingBandwidth, Traffic, and PortsIP AddressesMigration, Cloning, and Changing Data CentersCreation, Deployment, and DeliverySuspension, Deletion, and RecoveryPerformance AnomaliesCommon Console Error ReferenceUsage Limits and Common QuestionsHow to Manually Configure IPv6 in Nube CloudHow to Access Nube Cloud Virtual Machines Using SSH KeysQuotas, Credit Line, and Balance
Bare Metal Servers
Bare Metal Server (Dedicated Server / Bare Metal) RentalBare Metal Delivery and Rack InstallationBare Metal Customization and ColocationBare Metal Cancellation, Reclamation, and RefundsPioneer Program
Network, IP & Routes
Network Route Types: International Lite, International Optimized, and China OptimizedSelf-Service Network Troubleshooting: Unreachable, Packet Loss, Latency, and JitterHome Broadband IPs and Residential Broadband: Activation and TrialIP Prefix Leasing, Announcements, ASN, and RPKI RequestsChanging Network Lines, Replacing IPs, and Adjusting RoutesPort Blocking and GFW Blocking: IP Replacement, Port 25, and UnblockingTest IPs, Looking Glass, and Paid TestingCommon Network IssuesHong Kong Anti-DDoS China-Optimized Service Quota GuideWhat's the Difference Between International Lite and International Optimized?DDoS Protection and China Optimized Quota
DDoS
CDN Activation, Configuration, and MigrationCDN Plans, Renewal, and Traffic Rules
AI API
Model List, Capabilities, and AvailabilityError-Code Troubleshooting: 400, 403, 429, 503, and Thinking BlocksRate Limits, Concurrency, and Quota RulesBilling and Usage: Token Accounting, Caching, and Billing DisputesAI API Integration GuideModel Technical Notes: Deployment, Quantization, and Capabilities
Support/
Service & Products

How to Access Nube Cloud Virtual Machines Using SSH Keys

Introducing Nube.SH

Nube.SH is a powerful cloud computing platform designed for rapid deployment and management of cloud hosts. Formerly the well-known Kuaichedao, it builds upon its predecessor's strengths to further enhance performance and user experience. It currently offers services in two availability zones: Hong Kong and San Jose. With its independently developed management panel, users can elastically manage cloud resources with ease.

It provides highly cost-effective cloud hosting solutions. For example, a configuration with 1 vCPU EPYC 7713 + 1 GB DDR4 RAM starts at just $2.82 per month. It offers users flexible resource configurations and a stable network environment, suitable for various developers and enterprises. For more information, visit Nube.SH.

What is an SSH Key? Why use it?

Definition of SSH Key

An SSH Key is a secure authentication method based on asymmetric cryptography, consisting of a Public Key and a Private Key. The public key is used to encrypt information, while the private key is used to decrypt it. Compared to traditional password logins, SSH keys offer higher security and convenience.

Security and Convenience

A significant advantage of using SSH keys is their effectiveness in preventing brute-force attacks, as the key length is far greater than that of a typical password. Additionally, SSH keys simplify the login process, which is particularly important in automated scripts and large-scale server management. The Public Key can be distributed freely, while the Private Key must be kept strictly confidential. Only users holding the Private Key can complete the authentication, greatly reducing the risk of attacks.

SSH Key Types and Their Performance Comparison

Common SSH key types in practice include ssh-rsa, ecdsa-sha2-nistp256, and ssh-ed25519. Different types have distinct encryption characteristics and performance.

  •   ssh-rsa: The traditional RSA encryption method. It has good compatibility but longer keys and average performance, suitable for general use cases.
  •   ecdsa-sha2-nistp256: An elliptic curve-based algorithm. It has shorter keys and higher computational efficiency, suitable for scenarios requiring efficient connections.
  •   ssh-ed25519: A modern encryption algorithm with extremely high security, the shortest keys, and the best performance, ideal for high-security and high-performance requirements.

Generating SSH Keys on Different Operating Systems

Windows

On Windows, users can generate SSH keys via Git Bash or the Windows Subsystem for Linux (WSL). Here is a simple command example:

ssh-keygen -t rsa -b 4096 -C "name"

This command generates a 4096-bit RSA key.

macOS

On macOS, users can generate SSH keys directly from the Terminal. The command is similar to the one for Windows:

ssh-keygen -t ed25519 -C "name"

The generated key will be saved in the ~/.ssh/ directory.

Linux

In Linux, users can also generate SSH keys in a similar way. There might be slight differences between distributions, but the command is essentially the same.

ssh-keygen -t ecdsa -b 521 -C "name"

This command generates a 521-bit ECDSA key.

SSH Key Generation Process: macOS Example

  1.  Execute the command:

   You can use the following command to generate a 4096-bit RSA key pair:

   bash    ssh-keygen -t rsa -b 4096    

  1.  Choose a file path:

   The system will prompt you to choose a location to save the key:

       Enter file in which to save the key (/Users/xxx/.ssh/id_rsa):    

   -   Press Enter to use the default path /Users/xxx/.ssh/id_rsa.    -   If you want to save the key in a different location or use a different filename, enter a custom path here.

  1.  Set a passphrase:

   The system will prompt you to set a passphrase:

       Enter passphrase (empty for no passphrase):    

   -   Setting a passphrase adds an extra layer of security to your private key.    -   If you don't need a password (e.g., for automated scripts), you can press Enter to leave it empty.

   You will need to enter the same passphrase again to confirm:

       Enter same passphrase again:    

  1.  Generation successful:

   After the key is generated, the system will confirm that the private and public keys have been saved:

   ```    Your identification has been saved in /Users/xxx/.ssh/id_rsa

   Your public key has been saved in /Users/xxx/.ssh/id_rsa.pub    ```

   -   Private key file: /Users/xxx/.ssh/id_rsa    -   Public key file: /Users/xxx/.ssh/id_rsa.pub

   The system also generates a key fingerprint and a randomart image to further verify the key's uniqueness.

Terminal output reference

xxx@xxx-Mac-Pro:~ xxx$ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/xxx/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/xxx/.ssh/id_rsa
Your public key has been saved in /Users/xxx/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:M2ZTDRA5QgqRN5zyPNzTbzJMbpTxjhjSkLl5AkO5HD8 [email protected]
The key's randomart image is:
+---[RSA 4096]----+
| .+= =. o+.      |
|  B.O.. +  o     |
| . %.B o =. .    |
|  o E * =..      |
|     * OS+       |
|      .oB++      |
|       . +       |
|                 |
|                 |
+----[SHA256]-----+
xxx@xxx-Mac-Pro:~ xxx$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6fOYxxJA9v9CfHNr8vUrex9BQ5k/F2T0HYKaU3gvwYOEBewTBSCH1PRcvndNwy3VcZgdwKRFzZy5h8/G0QE58NV3N628wQBFDfy0TJD5BsxyjX0wJ1o/Dgi4lXmKC10+6t4uwV75ouFN3kFUmmieN81owvI/R+KLblW1LycegXoT+KNaXqy16JQrXifqUy7OAB+7Ybqkj1i+eCla+vERttrd0WwtqSGLQkuBTEsC6Dp+Dc35kYpShebK720yp7ZUEd5s9KpuSETOoyMDm+Ue3NljeXu97wTYqGe5oWr8pbXfQPVXjnT9RIXHYf9M1RvIF9EkY83pxv5Vb3quLWMi12UTmOc8jbRGebTwRQvGVayprCI8vY8Kgpq30+fyQ86OF3oMS7AhJEdbXkT9w+uUtttc+2bqw+rZPW1gDAchPARS5gtklYz7GrlksvnvOL4rHa/fmt7P1Mnz4KBI/8xXcqjkwm/l77bGWMK1yDyY735ySu+a22X+emwXMPC5Zs837n8eCQ9csjxz6XvhJpV1sO/Wnn75QbeF/tkpStA0kOMxjmbU1FbRI2FqTERw1UvtOBp5ZjuxmrEdFYEF42jaaprcNTJ4OxS03UKpnMu/4wzAed0iSrkX8TkB0MYKBLy8bw26LXXK0okCMM5niJ3H+X7cZ3BUbxEvQwlI7mdchXw== [email protected]
xxx@xxx-Mac-Pro:~ xxx$

Using SSH Keys on Nube Cloud

Viewing the Generated Key File

You can use the following command to view the contents of the generated public key:

cat ~/.ssh/id_rsa.pub

Copy the displayed public key and add it to the ~/.ssh/authorized_keys file on the server you need to access. For example, copy the following content into the file:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6fOYxxJA9v9CfHNr8vUrex9BQ5k/F2T0HYKaU3gvwYOEBewTBSCH1PRcvndNwy3VcZgdwKRFzZy5h8/G0QE58NV3N628wQBFDfy0TJD5BsxyjX0wJ1o/Dgi4lXmKC10+6t4uwV75ouFN3kFUmmieN81owvI/R+KLblW1LycegXoT+KNaXqy16JQrXifqUy7OAB+7Ybqkj1i+eCla+vERttrd0WwtqSGLQkuBTEsC6Dp+Dc35kYpShebK720yp7ZUEd5s9KpuSETOoyMDm+Ue3NljeXu97wTYqGe5oWr8pbXfQPVXjnT9RIXHYf9M1RvIF9EkY83pxv5Vb3quLWMi12UTmOc8jbRGebTwRQvGVayprCI8vY8Kgpq30+fyQ86OF3oMS7AhJEdbXkT9w+uUtttc+2bqw+rZPW1gDAchPARS5gtklYz7GrlksvnvOL4rHa/fmt7P1Mnz4KBI/8xXcqjkwm/l77bGWMK1yDyY735ySu+a22X+emwXMPC5Zs837n8eCQ9csjxz6XvhJpV1sO/Wnn75QbeF/tkpStA0kOMxjmbU1FbRI2FqTERw1UvtOBp5ZjuxmrEdFYEF42jaaprcNTJ4OxS03UKpnMu/4wzAed0iSrkX8TkB0MYKBLy8bw26LXXK0okCMM5niJ3H+X7cZ3BUbxEvQwlI7mdchXw== [email protected]

Uploading a Public Key to Nube Cloud

Users can upload their Public Key in the Nube Cloud control panel. The specific steps are as follows:

Method One

  1.  Click the profile picture in the top right corner.
  2.  Select User ➡️ Select SSH Key.
  3.  Click Add ➡️ Add Public Key. image

Method Two

Users can upload their Public Key in the Nube Cloud control panel. The specific steps are as follows:

  1.  Log in to the Nube Cloud control panel.
  2.  Go to Deploy ➡️ Configure & Order.
  3.  Under Install, click Add Public Key.

Note: This is for demonstration only. Use your actual generated key. image

Injecting an SSH Key During Cloud Host OS Installation

When creating or reinstalling a cloud host, users can choose to automatically inject an SSH Key. This ensures that the user can immediately access the cloud host via the SSH key after the installation is complete.

How to Manage and Securely Store SSH Keys

Distinguishing Between Public and Private Keys

The Public Key can be shared openly and is used on the server to verify the user's identity. The Private Key must be kept strictly confidential and is only used on the client-side for login.

Securely Storing the Private Key

It is recommended to store the Private Key in the user's ~/.ssh/ directory and set strict file permissions. For example:

chmod 600 ~/.ssh/id_rsa

This command ensures that only the user can read and write to the file.

Regularly Updating SSH Keys

To ensure account security, it is recommended to update SSH keys regularly, especially if a key might have been compromised in situations such as:

  •   Changes in the system or environment.
  •   Encountering security-related threats or concerns.

By regularly changing SSH keys, you can effectively reduce the risk of hacking and ensure the security of your servers and sensitive data. 」