laravel / forge-cli

The Laravel Forge CLI.
https://forge.laravel.com
MIT License
227 stars 35 forks source link

Not able to SSH into server after `forge ssh:configure` #45

Closed ethanclevenger91 closed 3 years ago

ethanclevenger91 commented 3 years ago

Description:

Picking up from here, forge ssh:test and other ssh commands are resulting in:

Unable to connect to remote server. Maybe run [ssh:configure] to configure an SSH Key?

Which I've already done for this server. I've reproduced this on two machines.

Steps To Reproduce:

  1. Globally install forge-cli
  2. Run forge login and add API key
  3. Run `forge ssh:configure [some-existing-server-slug], and name it some-existing-server-slug. See:
    ==> Creating Key [some_existing_server_slug.pub]
    ==> Adding Key [some_existing_server_slug.pub] With The Name [some-existing-server-slug] To Server [some-existing-server-slug]
    ==> SSH Key Based Secure Authentication Configured Successfully
  4. Run forge ssh some-existing-server-slug
  5. See:
    Unable to connect to remote server. Maybe run [ssh:configure] to configure an SSH Key?
  6. Run forge server:current. See you're in the context of the server you just configured SSH for
  7. Run forge ssh:test. See:
    Unable to connect to remote server. Maybe run [ssh:configure] to configure an SSH Key?
  8. Log into Forge. See SSH key has been added to server.

I noted in the other issue that I wasn't clear how the system was deciding which SSH key to present and that some debugging was turning up Permission Denied errors, but it's been a while so I'm not 100% sure on any of that anymore.

nunomaduro commented 3 years ago

Do you mind of running the command above and let me know what do you see?

ssh -o "IdentitiesOnly=yes" -i YOUR_KEY_NAME forge@YOUR_SERVER_IP
nunomaduro commented 3 years ago

I will re-open this ticket, once you answer to my previous question @ethanclevenger91.

ethanclevenger91 commented 3 years ago

@nunomaduro

$ ssh -o "IdentitiesOnly=yes" -i ~/path/to/key forge@SERVER_IP
Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-88-generic x86_64)

Connects successfully