Can't SSH into my new Vultr Cloud Compute instance (Ubuntu): connection blocked or permission denied. How do I add my SSH key?

View profile

I'm deploying a project for a hackathon on a Vultr Cloud Compute instance (Ubuntu) and I can't connect to it over SSH from my Windows 11 PC (PowerShell, OpenSSH client).

What I'm trying to do:

Log in over SSH with my own key pair and deploy a Docker Compose app on the instance.

What I tried:

- Ran ssh root@<server-ip> from PowerShell. [Replace with the exact error: "Permission denied (publickey)", "Connection timed out" or "Connection refused".]

- Generated an ed25519 key with ssh-keygen -t ed25519 and added the public key under Account > SSH Keys.

- Checked the Firewall page for port 22.

- I can log in through View Console.

What happened:

SSH keeps being blocked or refused. I think the key I added to my account was not injected into the instance, because I added it after the server was created.

My questions:

1. Is it correct that account SSH keys are only added to servers at creation time?

2. What's the right way to add my public key to an existing instance (authorized_keys through the console)?

3. What else could block SSH (firewall group, ufw, fail2ban, too many failed attempts) and how do I check each one?

Any help is appreciated. The submission deadline is today.

Answer
TCEM
2 answers

Join Vultr Community

Points, levels & badges

Enter challenges & submit builds

Register to events & meetups

Get your work featured

2 Answers

Accepted Answer — marked by @member-d0382f8f
1
Answered: 20 hours ago

1. Yes, account SSH keys are only injected at creation time.

If you add the key in Account > SSH Keys AFTER you created the instance, Vultr will NOT push it to that existing instance. That's why you get Permission denied (publickey) even though the key is in your account.

2. How to fix an existing instance — via View Console:

Since you CAN log in via View Console, do this inside the console:

1. Yes, account SSH keys are only injected at creation time.

If you add the key in Account > SSH Keys AFTER you created the instance, Vultr will NOT push it to that existing instance. That's why you get Permission denied (publickey) even though the key is in your account.

2. How to fix an existing instance — via View Console:

Since you CAN log in via View Console, do this inside the console:

1
0
Answered: 20 hours ago

Thanks, that explains it. I added the key to my account after creating the instance, so it was never pushed to the server.

Your answer looks cut off after "do this inside the console". Could you post the full commands for adding my public key to ~/.ssh/authorized_keys (including the permissions steps)?

I'm planning to run this on the instance via View Console:

mkdir -p ~/.ssh && chmod 700 ~/.ssh

echo "<my public key>" >> ~/.ssh/authorized_keys

chmod 600 ~/.ssh/authorized_keys

Is that correct, or is anything missing (for example sshd settings, or PasswordAuthentication/PermitRootLogin in /etc/ssh/sshd_config)? I'll report back whether it works.

0

Post Answer