8 Aug 2025
If you're using a VPS, the safest way to log in is not with a password — it's with SSH keys.
In this guide, you'll learn how to create an SSH key on Linux, and how to use it to securely access your VPS (for example, from nanohost.org, where VPS plans start at just $8/month).
No prior experience required.
An SSH key is a pair of files used to authenticate with a server. It consists of:
When you try to log in, your VPS checks the public key, and if it matches your private key, access is granted — no password needed.
Open your Terminal and run: ssh-keygen
You’ll see something like:
Just press Enter to accept the default location.
➕ You’ll then be asked:
Enter passphrase (empty for no passphrase):
This is optional. If you want extra security, type a passphrase.
Otherwise, press Enter twice to skip.
🎉 Done! Your SSH key pair is now created.
Your keys are saved in the ~/.ssh
folder:
~/.ssh/id_rsa
~/.ssh/id_rsa.pub
Never share your private key!
Assuming your VPS IP is 45.12.34.56 and your username is root:
ssh-copy-id root@45.12.34.56
You’ll be asked to enter your VPS password once. After that, your key will be uploaded.
Don’t have ssh-copy-id
? Use this:
cat ~/.ssh/id_rsa.pub | ssh root@45.12.34.56 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
Now try logging in:
ssh root@45.12.34.56
If everything worked, you’ll be logged in without a password!
To force key-only logins, edit the SSH config on your server: nano /etc/ssh/sshd_config
Find or add these lines:
PasswordAuthentication no
PermitRootLogin prohibit-password
Then restart SSH:
systemctl restart ssh
⚠️ Only do this if you're sure your key works! Otherwise, you may lock yourself out.
Looking to set up your own server?
At nanohost.org, you get:
Perfect for running proxies, apps, or learning Linux.
Whether you’re applying kernel updates, clearing a stuck device, or finishing a configuration change, a reboot is sometimes the cleanest fix. This guide shows beginner-friendly and safe ways to restart Linux immediately (“reboot now Linux”), plus how to force reboot if the system is unresponsive. We’ll cover desktops, servers, and remote machines over SSH.
Learning how to move around and manage files and folders in the Linux filesystem is one of the most important skills for working with any computer. On cloud servers, these tasks are usually done through the terminal using well-known Linux shells and standard commands. This guide will walk you through some of the essential skills needed to work with files and directories from the terminal.
Learn the basics of the Linux terminal — what it is, how the shell and command prompt work, and how to run your first commands.