Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

penguinfeet's avatar

Laravel 5 SSH into Forge with Public SSH Key - Permission denied (publickey).

Hi guys,

I am trying to follow along with the Laracast here and connect to my DB on a Larave 5 project using Forge:

https://laracasts.com/series/server-management-with-forge/episodes/4

However, I am running into trouble. No matter what I've done, I run into the error:

Permission denied (publickey).

I have tried creating a public SSH key on my machine using:

ssh-keygen -t rsa -C "my_email@gmail.com"

I save it like so:

/Users/**********/.ssh/somekey

which generates an identification: somekey and a public key: somekey.pub

Then I use the command:

cat ~/.ssh/somekey.pub| pbcopy

to copy the key and then I put it in my SSH keys on my server in forge.

However, when I use the command: ssh forge@forge_ip_address

I get the same error: Permission denied (publickey).

Is there something I can do? Thank you!

0 likes
5 replies
arianmaps's avatar

It's important to note that the correct user is 'forge'.

I was trying to connect with 'root' (as it was the one that was showing up on the linode remote access tab), but that one doesn't work. That's because, forge disables the regular password authentication by default.

Please, note that after the instances are provisioned you should receive an email from Forge with all these details including sudo and mysql passwords.

So, you would do ssh with the key, and then use the password sent via email for sudo and mysql.

I hope this helps someone!

11 likes

Please or to participate in this conversation.