Training Center

Master your AI-ready infrastructure with comprehensive guides and tutorials

Training Navigation

SSH Setup Guide

Complete beginner's guide to setting up secure SSH access to your VMs

What is SSH and Why Do I Need It?

Secure Shell (SSH)

SSH is a secure way to connect to your virtual machines over the internet. Think of it like a secure tunnel that lets you control your VM from your computer.

SSH Keys vs Passwords

Instead of typing a password each time, SSH keys provide automatic, secure access. It's like having a special key that only you can use to unlock your VM.

Why SSH Keys Are Better

  • More Secure: Much harder to hack than passwords
  • Convenient: No need to remember or type passwords
  • Automated: Perfect for scripts and automated tools

Step 1: Generate Your SSH Key Pair

First, we need to create your SSH key pair. This creates two files: a private key (keep secret) and a public key (share with your VM).

Windows

Option 1: Git Bash (Recommended)

Step 1: Open Git Bash (install from git-scm.com if needed)

Step 2: Run this command (replace with your email):

ssh-keygen -t ed25519 -C "your_email@example.com"

💡 Tip: Press Enter when asked for file location (uses default)

💡 Tip: Press Enter when asked for passphrase (optional)

Option 2: PowerShell

Step 1: Open PowerShell as Administrator

Step 2: Run this command:

ssh-keygen -t ed25519 -C "your_email@example.com"
Copy Your Public Key

Step 3: Copy your public key to clipboard:

cat ~/.ssh/id_ed25519.pub

💡 Tip: Right-click to copy the output, or use clip command

macOS/Linux

Generate Your SSH Key

Step 1: Open Terminal (macOS) or your preferred terminal (Linux)

Step 2: Run this command (replace with your email):

ssh-keygen -t ed25519 -C "your_email@example.com"

💡 Tip: Press Enter when asked for file location (uses default)

💡 Tip: Press Enter when asked for passphrase (optional)

Copy Your Public Key

Step 3: Display your public key:

cat ~/.ssh/id_ed25519.pub

💡 Tip: Select and copy the entire output (starts with ssh-ed25519)

macOS Tip: Copy directly to clipboard:

pbcopy < ~/.ssh/id_ed25519.pub

Linux Tip: Copy directly to clipboard (if xclip is installed):

xclip -sel clip < ~/.ssh/id_ed25519.pub

Alternative: RSA Key (if needed)

If you encounter issues with Ed25519 keys, you can use RSA keys instead. They're slightly older but still very secure.

Generate RSA key:

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Copy your public key:

cat ~/.ssh/id_rsa.pub

Step 2: Add Your SSH Key to Your VM

Now that you have your SSH key, you need to add it to your VM so it recognizes you as an authorized user.

1

Go to Your Dashboard

Navigate to your SSH Grid dashboard and find the VM you want to connect to.

2

Click "Add SSH Key"

In the VM's action menu, click the "Add SSH Key" button (looks like a key icon).

3

Paste Your Public Key

Paste the public key you copied earlier (the long text starting with ssh-ed25519 or ssh-rsa).

4

Confirm Addition

Click "Add Key" and wait for the confirmation message. Your VM will now recognize your SSH key!

Important Note:

Your public key starts with ssh-ed25519 or ssh-rsa and ends with your email. Copy the entire line when adding it to your VM.

Step 3: SSH Config Setup (Optional but Recommended)

An SSH config file lets you create shortcuts for your VMs. Instead of typing the full command, you can just type ssh vm-name.

Create Your SSH Config File

Windows (Git Bash)

Open Git Bash and run:

nano ~/.ssh/config
macOS/Linux

Open Terminal and run:

nano ~/.ssh/config

Add Your VM Configuration

In the editor that opens, add the following configuration (replace with your actual VM details from the dashboard):

Example SSH Config Entry:
Host vm-example
    HostName vm-example.sshgrid.com
    Port 2222
    User ubuntu
    IdentityFile ~/.ssh/id_ed25519
1

Host: This is the nickname you'll use to connect (e.g., vm-example)

2

HostName: Your VM's domain (found in the dashboard)

3

Port: Usually 2222 for SSH Grid VMs

4

User: Usually ubuntu for SSH Grid VMs

5

IdentityFile: Path to your private key file

Save and Exit

To save the file in nano:

Ctrl + X, then Y, then Enter

💡 Tip: Ctrl+X exits, Y confirms saving, Enter confirms the filename

Connect Using Your Shortcut

Now you can connect using just the host name:

ssh vm-example

💡 Tip: Much easier than typing the full command every time!

Connection Methods

There are several ways to connect to your VMs. Choose the method that works best for your workflow.

Direct SSH Command

Use the full SSH command with all parameters:

ssh ubuntu@vm-example.sshgrid.com -p 2222

Best for: Quick connections, scripts, or when you don't have SSH config set up

SSH Config Method

Use the short hostname after setting up SSH config:

ssh vm-example

Best for: Regular use, multiple VMs, or when you want to remember hostnames

Troubleshooting Common Issues

Don't worry if you encounter issues! Here are solutions to the most common problems.

Permission Denied (publickey)

This means your SSH key isn't recognized by the VM.

1

Check that you added your SSH key to the VM in the dashboard

2

Make sure you copied the entire public key (starts with ssh-ed25519)

3

Wait a few minutes after adding the key before trying to connect

Connection Refused

The VM isn't accepting connections.

1

Check that your VM is running (green status in dashboard)

2

Verify you're using the correct port (usually 2222)

3

Check your firewall settings if you're behind a corporate network

Host Key Verification Failed

This is normal for new connections and is actually a security feature.

1

Type yes when prompted and press Enter

2

This adds the VM's key to your trusted hosts list

3

Future connections won't ask for this confirmation

Still Having Issues?

If you're still having trouble, here are some additional steps:

1

Try the web terminal in your dashboard first to test connectivity

2

Check the VM's connection info in the dashboard for the exact details

3

Make sure your SSH key file permissions are correct (600 for private key)

VM Management

Master the art of managing your virtual machines like a pro

What is a Virtual Machine?

Your Own Computer in the Cloud

A Virtual Machine (VM) is like having your own computer running on powerful servers in the cloud. It has its own operating system, storage, and can run applications just like your local computer.

Why Use VMs?

  • Scalability: Start small, grow as needed
  • Isolation: Each VM is completely separate
  • Flexibility: Run different operating systems
  • Cost-Effective: Pay only for what you use

Understanding VM Lifecycle

VMs have different states, just like a computer. Understanding these states helps you manage them effectively.

Running

VM is active and ready to use

Stopped

VM is off but data is saved

Shutdown

VM is completely powered off

Processing

VM is starting, stopping, or updating

Power Management

Learn how to control your VM's power state and when to use each option.

Power On

Starts your VM and makes it ready for use.

Use when you want to work on your VM

VM will be accessible via SSH

$

Consumes resources and may incur costs

Power Off / Shutdown

Completely stops your VM and saves all data.

Saves money when not in use

All your data is preserved

Takes a few minutes to start up again

Reboot

Restarts your VM while preserving all data.

Fixes many software issues

Applies system updates

Temporary downtime (1-2 minutes)

VM Operations

Advanced operations for managing your VMs effectively.

Clone VM

Create an exact copy of your VM with all data and settings.

1

Perfect for creating backups

2

Test new configurations safely

3

Create multiple identical environments

Note: Cloning creates a new VM with a new name and IP address.

Delete VM

Permanently remove a VM and all its data.

This action cannot be undone

All data will be permanently lost

Stops billing for the VM

Warning: Make sure you have backups before deleting!

Best Practices

Follow these guidelines to manage your VMs efficiently and safely.

Backup Strategy

1

Clone important VMs regularly

2

Keep multiple versions of critical data

3

Test your backups periodically

Cost Optimization

1

Power off VMs when not in use

2

Delete unused VMs to avoid charges

3

Monitor your usage regularly

Security

1

Keep VMs updated with security patches

2

Use SSH keys instead of passwords

3

Regularly review access permissions

Organization

1

Use descriptive VM names

2

Document your VM configurations

3

Keep a list of running VMs

Monitoring & Maintenance

Keep your VMs healthy and performing well with regular maintenance.

Regular Tasks

Check VM status daily
Update system packages weekly
Review resource usage monthly
Clean up unused files

Performance Tips

Monitor disk space usage
Check for running processes
Review log files for errors
Restart services if needed

Security Best Practices

Secure your infrastructure with industry best practices

Content coming soon...