Secure, Passwordless Access with SSH Keys

Managing your Linux VPS or dedicated server demands robust security, and SSH key authentication is the gold standard for secure, passwordless access. Unlike traditional passwords, SSH keys use strong encryption to provide faster, safer logins, ideal for both manual access and automated workflows. For example, setting up SSH keys for your ava.hosting VPS ensures secure access to your web server while enabling seamless integration with tools like Git or Ansible. This guide walks you through generating, adding, and using SSH keys for new or existing servers, optimized for ava.hosting’s high-performance infrastructure.

What Is an SSH Key and Why Use It?

An SSH key pair consists of two parts:

  • Public key: saved on the server
  • Private key: kept securely on your local device

When you connect via SSH, your system proves it holds the private key, and the server grants access — no password needed.

Benefits of Using SSH Keys:

FeatureBenefit
Strong encryptionNear-impossible to brute-force
No password storageEliminates risk of leaked or reused passwords
Faster loginInstant authentication
Automation friendlyIdeal for scripts, Git, Ansible, CI/CD tools

Option 1: Add SSH Key When Creating a New VPS

You can add your SSH key during the VPS creation process — it’s fast and secure.

Steps:

  • Log in to your hosting provider’s control panel and start the VPS setup process
  • Locate the SSH Key or Authorized Keys section
  • Paste your public key (see below how to generate it)
  • Complete the deployment — once the VPS is live, you can log in via SSH without a password

💡 You can add multiple keys if multiple users or devices need access.

Option 2: Add SSH Key to an Existing VPS

Already have a running server? Here’s how to manually add your public key:

Step 1: Generate an SSH Key (if you don’t have one)

On your local machine (Linux/macOS/WSL/Windows Terminal):

ssh-keygen -t ed25519 -C "your@email.com"
  • Press Enter to confirm the default file location
  • Enter a passphrase for additional protection (optional)

Step 2: Copy the Public Key

Use this command to display your public key:

cat ~/.ssh/id_ed25519.pub

Or copy it directly to your VPS:

ssh-copy-id username@your-server-ip

Replace username (usually root) and your-server-ip.

Step 3: Manual Method (Optional)

If ssh-copy-id is unavailable, log in with a password and run:

mkdir -p ~/.ssh
nano ~/.ssh/authorized_keys

Paste your public key, save the file, then:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Done — you can now log in without entering a password.

⚙ How to Use the SSH Key to Connect

Once your public key is on the server, connect like this:

ssh root@your-server-ip

If you saved your key under a custom filename:

ssh -i ~/.ssh/my_custom_key root@your-server-ip

Where Are SSH Keys Stored?

LocationPurpose
~/.ssh/id_ed25519Your private key (keep secure!)
~/.ssh/id_ed25519.pubPublic key (safe to share)
/root/.ssh/authorized_keysVPS location for access

Security Tip: Disable Password Logins

For extra protection, disable password authentication entirely:

  • Edit SSH config:nano /etc/ssh/sshd_config
  • Change:PasswordAuthentication no
    PermitRootLogin prohibit-password
  • Restart SSH:systemctl restart sshd

⚠ Only do this once your key login is confirmed working.

Conclusion

SSH key authentication is the cornerstone of secure, passwordless access to your ava.hosting VPS or dedicated server. By eliminating password vulnerabilities and enabling fast, encrypted logins, SSH keys are ideal for both manual management and automated workflows. For example, you can use SSH keys to securely deploy updates to a Node.js app on your server or automate backups with rsync. With this guide you can set up SSH keys in minutes, ensuring a secure, scalable, and efficient server management experience.