Use SSH Key with Virtual Machine
This guide explains how to connect to a CloudRaya Virtual Machine using an SSH key from different operating systems.
SSH key authentication allows you to log in securely without entering a password every time.
Before You Begin
Make sure that:
- Your Virtual Machine:
- Is running
- Has a Public IP address
- Uses a Linux OS (SSH key authentication applies to Linux)
- An SSH key was:
- Generated automatically or
- Imported during VM creation
- You have access to the private key file on your local device
📄 See:
Required Information
You will need:
-
Public IP address of the VM
(from VM Detail page)
-
Username, usually:
root- or the default OS user (for example:
ubuntu)
-
Private key file:
- Downloaded
.txtor.pemfile - Generated by CloudRaya or created previously
- Downloaded
Connect from Linux
Step 1: Open Terminal
Open your terminal application.
Step 2: Set Private Key Permission
SSH requires strict file permissions.
chmod 600 /path/to/private-key.txtExample:
chmod 600 ssh-key-myvm.txtStep 3: Connect Using SSH
ssh -i /path/to/private-key.txt username@PUBLIC_IPExample:
ssh -i ssh-key-myvm.txt root@198.167.141.78Step 4: Accept Host Fingerprint
If prompted:
Are you sure you want to continue connecting (yes/no)?Type:
yesYou are now logged in to the VM.
Connect from macOS
macOS uses the same SSH workflow as Linux.
Step 1: Open Terminal
Open Terminal.app
Step 2: Set Private Key Permission
chmod 600 /path/to/private-key.txtStep 3: Connect Using SSH
ssh -i /path/to/private-key.txt username@PUBLIC_IPExample:
ssh -i ssh-key-myvm.txt root@198.167.141.78Step 4: Login Successful
You should now see the VM shell prompt.
Connect from Windows (Using OpenSSH)
Windows 10 and newer include OpenSSH by default.
Step 1: Open PowerShell or Command Prompt
Open PowerShell or Command Prompt.
Step 2: Navigate to Private Key Location
cd C:\Users\YourUser\DownloadsStep 3: Connect Using SSH
ssh-i ssh-key-myvm.txt username@PUBLIC_IPExample:
ssh-i ssh-key-myvm.txt root@198.167.141.78Step 4: Confirm Connection
Type yes if prompted to trust the host.
You are now connected to the VM.
Connect from Windows (Using PuTTY)
If you prefer PuTTY:
Step 1: Convert Private Key (Optional)
PuTTY requires .ppk format.
Use PuTTYgen to convert:
- Load the private key file
- Save as
.ppk
Step 2: Configure PuTTY
- Host Name:
username@PUBLIC_IP - Port:
22 - Connection → SSH → Auth
- Browse and select the
.ppkfile
- Browse and select the
Step 3: Connect
Click Open to start the SSH session.
Common Issues and Solutions
Permission Denied (publickey)
Possible causes:
- Wrong username
- Wrong private key file
- SSH key was not selected during VM creation
Lost Private Key
- CloudRaya cannot recover private keys
- Solution:
- Create a new SSH key
- Recreate the VM or update access manually
Connection Timeout
Check that:
- VM is running
- Public IP is attached
- Firewall / ACL allows SSH (port 22)
Security Best Practices
- Store private keys securely
- Never share private keys
- Use different SSH keys for:
- Development
- Production
- Delete unused SSH keys