After Laravel Forge setup, "Permission denied (publickey)"

May 21, 2014 20.3k views
Yesterday I created a Digital Ocean account and connected with Laravel Forge. I generated a new droplet via Forge. After it's created, I try to log in using keys. I keep getting an "Permission denied (publickey)" error. I tried deleting the contents of my known_hosts file. After attempting to connect I got the untrusted server message and opted in. The new key was written to my known_hosts. And then the same error appeared. Any ideas or tests I can run to see what's happening?
2 comments
  • It was the same with me . That's why you pulled root access. try using The Following command , subistitua the " root @ " For Their user ' yourusername @ " :
    ssh your
    username@IP

  • username gets reset to forge@IP

9 Answers
Rich:

I hit this problem as well. Here's the solution (assuming you've already correctly added your public key to the Forge UI)...

In the welcome email it says your username is "forge". So use this on the command line, and replace with your server's IP:

ssh forge@12.34.56.78

Hope that helps.
No idea. Ask Laravel Forge support. That or learn to setup a LEMP stack yourself.
Hi Rich,

Did you configure an SSH key in Laravel Forge?

http://mattstauffer.co/blog/getting-your-first-site-up-and-running-in-laravel-forge#ssh-key
To Alex: been there, done that, moved on to Laravel Homestead and Forge on Vagrant, because it's nifty. Thanks anyway.

To Andrew... I actually did follow the mattstauffer.co instructions... and have cycled and recycled through various things I found on stackoverflow et al. Now it's in DO Support's court.

FYI, in case anyone else has problems, the deployment from Forge seems to disable password access, so the keys are necessary, and so server-side fiddling isn't possible. I must admit I'm no expert at this keygen stuff, but followed instructions to the letter, pretty sure.

Thanks... I'll try to get back here with the resolution.
Rich, I encountered the same issue.

Turns out I was copied the key incorrectly, I tried it again, by doing the pbcopy to the clipboard and inserting it in the forge admin panel and all worked 100%.

Seems a straight copy paste on my mac screwed something up.
Thanks @andy and @dylan forge@ip_address cured my problems but I also believe I had the copy issue as well.

Cheers

Same here. Doesnt matter how do i try to do it, simply not working. Could this be doe to the new API (forge uses v1.0)?

I have same problem . I need help .

  • Hi shopping.
    I had the same problem, but I found the solution deleting the prior ssh key from laravel forge, and re-copying the id_rsa (from your computer) with this command:

    $ pbcopy < ~/.ssh/id_rsa.pub

    Then... all work fine

For those whom tried using the pbcopy on the GitBash command and did not work try:
$ clip < ~/.ssh/idrsa.pub. It will basically copies your SSH Key to a clipboard, paste it to your Forge Dashboard. Once that is done, try to log in using ssh name@your-ip -i ~/.ssh/idrsa.pub

***Can someone tell me how can I login to my database now? Should I use Digital Ocean at all anymore?

Have another answer? Share your knowledge.