Skip to main content

SSH Access to VPS

SSH (Secure Shell) allows you to remotely connect to your VPS and manage it securely from your local machine. This guide explains how to connect from different operating systems and apply basic security practices.

Requirements

Before connecting, make sure you have:
  • Your VPS public IP address
  • A username (usually root)
  • The VPS password or an SSH private key
  • An SSH client on your device

Connecting from Linux or macOS

Most Linux and macOS systems include SSH by default. Open a terminal and run:
ssh root@YOUR_VPS_IP
If this is your first time connecting, you will be asked to confirm the server fingerprint. Type yes and press Enter. Enter your password when prompted.

Connecting from Windows

Using PowerShell or Windows Terminal

Modern versions of Windows include an SSH client by default. Open PowerShell or Windows Terminal and run:
ssh root@YOUR_VPS_IP
Enter your password when prompted.

Using PuTTY

  1. Open PuTTY.
  2. Enter your VPS IP address in the Host Name field.
  3. Set the port to 22.
  4. Ensure the connection type is set to SSH.
  5. Click Open.
  6. Log in using your username and password.
SSH key authentication is more secure than password-based login.

Generate an SSH Key on Your Local Machine

ssh-keygen -t ed25519
Press Enter to accept the default file location and settings.

Add the Public Key to Your VPS

Log in to your VPS using password authentication, then run:
mkdir -p ~/.ssh
nano ~/.ssh/authorized_keys
Paste your public key into the file, save, and exit. Set correct permissions:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Log out and reconnect to verify key-based login works. After confirming SSH key login works, you can disable password authentication. Edit the SSH configuration file:
nano /etc/ssh/sshd_config
Set or update the following line:
PasswordAuthentication no
Restart the SSH service:
systemctl restart ssh
This prevents password-based logins and improves security.

Common SSH Issues

  • Connection refused SSH service may not be running or port 22 is blocked by a firewall.
  • Permission denied Incorrect username, password, or SSH key permissions.
  • Connection timed out Incorrect IP address or network-level firewall restrictions.

Security Best Practices

  • Use SSH keys instead of passwords
  • Keep your system updated
  • Restrict SSH access using firewalls
  • Avoid exposing unnecessary services to the public internet

What to Do Next

After connecting successfully, you can:
  • Install required software and services
  • Configure firewalls and security rules
  • Set up backups and monitoring
  • Prepare the VPS for production workloads