Loading Smiley Hoster
Skip to content

Set up a personal SSH key for your VPS

Smiley Hoster Team · · 2 min read
A key connects a personal computer to a VPS with a verified login.

Vultr's announcement of a Cycle.io MCP integration is a reminder to review how people reach infrastructure. A useful starting point on your own VPS is a personal SSH key with a login you have actually tested.

1. Keep a recovery route available

Use this walkthrough for an Ubuntu VPS running OpenSSH and a computer with an SSH client. You need an existing way to sign in to the intended account. The examples use admin@vps.example.com; substitute your real username and server address.

Leave your current connection open. Before changing access arrangements, establish how you would reach the server's recovery console and who can use it. Do not rely on a colleague being available when you next need access.

Generate a key on your computer if you do not already have a suitable one:

Example
ssh-keygen -t ed25519

Protect it with a passphrase. Stop if the command offers to overwrite an existing key you still need. Choose a different filename instead, then use that filename in the following commands.

The private file belongs on your computer. Its .pub companion is the public part that can be installed on the VPS. Do not send the private file to support, a shared drive or another administrator.

2. Add your public key to your account

On Linux or macOS with ssh-copy-id available, run:

Example
ssh-copy-id -i ~/.ssh/id_ed25519.pub \ admin@vps.example.com

Confirm the server identity against a trusted fingerprint before accepting a first connection. An unexpected identity warning deserves investigation.

If that helper is unavailable, use the existing session to append the public key as one complete line to the target account's ~/.ssh/authorized_keys. Preserve existing entries until you know who or what uses them. Work on the account you will actually use, rather than installing every administrator's key under one shared identity.

Keep a short access record: key owner, account and purpose. It gives you something concrete to review when responsibilities change.

3. Test a separate session

From a new local terminal, request public-key authentication explicitly:

Example
ssh -i ~/.ssh/id_ed25519 \ -o PreferredAuthentications=publickey \ -o PasswordAuthentication=no \ admin@vps.example.com

The key's passphrase prompt is expected. It unlocks your local private key and is different from the remote account password. Confirm that the new session reaches the intended server and supports your usual administrative work.

If login fails, use the original session to check the target account and public-key installation. Keep alternative access methods until the test succeeds. Record the successful test and how this key will be removed later; copying a file alone is not an access acceptance test.

Sources: Vultr, Ubuntu — OpenSSH.

Slide 1 of 5: Ubuntu VPS access. Your SSH key needs a login test. Add your public key, test a fresh session and keep a recovery route available.
Slide 2 of 5: Step 1 of 3. Keep a recovery route. Leave your current session open and check recovery console access. Protect your key with a passphrase. Keep the private key on your computer; only the .pub file goes on the VPS.
Slide 3 of 5: Step 2 of 3. Add the public key. Verify the server fingerprint. Add the public key to your intended account with ssh-copy-id or authorized_keys. Preserve existing entries and record the key owner, account and purpose.
Slide 4 of 5: Step 3 of 3. Test a fresh session. In a new terminal, request public-key authentication with password authentication disabled. Check the server and your usual admin work. Keep alternative access until the test succeeds.
Slide 5 of 5: Make access verifiable. Copying a key is not enough. Use the guide for the commands. Record a successful login test and how you will remove the key later.
On social media

See it in our social posts

The key steps of this article, as a carousel. Follow us to catch the next ones.

Did this article answer your question?
Your feedback shapes what we write next.

Your site online today

Free migration* · 30-day refund

Get started* A site under 30 GB, cPanel, WordPress and VPS plans.