Overview
SSH keys provide a more secure authentication method than passwords. They allow passwordless login to your instances while being much harder to compromise than traditional passwords.
Why Use SSH Keys?
Security
More secure than passwords, immune to brute force attacks
Convenience
No need to remember or type passwords
Automation
Enable automated deployments and scripts
Key Management
Easy to rotate and revoke access
Generating SSH Keys
On Linux/Mac
Open a terminal and run:
ssh-keygen -t ed25519 -C "your_email@example.com"For older systems that don't support Ed25519:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"Follow the prompts to save the key (default location is fine) and optionally set a passphrase for extra security.
On Windows
Windows 10/11: Use PowerShell or Windows Terminal:
ssh-keygen -t ed25519 -C "your_email@example.com"Older Windows: Use PuTTYgen to generate keys.
Adding SSH Keys to Control Panel
Step 1: Copy Your Public Key
# Linux/Mac
cat ~/.ssh/id_ed25519.pub
# Windows (PowerShell)
Get-Content $env:USERPROFILE\.ssh\id_ed25519.pubStep 2: Import to Cloud Panel
- Log into the Cloud Control Panel
- Go to Compute → Key Pairs
- Click Import Public Key
- Give your key a name
- Paste your public key into the text field
- Click Import Public Key
Using SSH Keys When Creating Instances
When launching a new instance:
- Complete the instance details (name, flavor, image)
- In the Key Pair section, select your imported key
- Launch the instance
The selected SSH key will be automatically added to the instance, allowing you to log in without a password.
Connecting with SSH Keys
Once your key is configured, connect to your instance:
ssh root@your-instance-ipOr for distributions that use a different default user:
# Ubuntu
ssh ubuntu@your-instance-ip
# Debian
ssh debian@your-instance-ip
# CentOS/Rocky/Alma
ssh centos@your-instance-ipAdding Keys to Existing Instances
To add an SSH key to an existing instance:
mkdir -p ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keysPaste your public key on a new line, then save and set permissions:
chmod 600 ~/.ssh/authorized_keysTroubleshooting
Permission Denied
If you get "Permission denied", check:
- Correct username for your OS (root, ubuntu, debian, etc.)
- SSH key file permissions are correct (600 for private key)
- Using the correct private key file
- Public key is properly added to authorized_keys
Specifying a Key File
If your key is not in the default location:
ssh -i /path/to/private_key user@instance-ipBest Practice
Always use SSH keys instead of passwords for cloud instances. They provide better security and are essential for automation. Consider using a passphrase on your private key for an additional layer of security.
