Search code examples
laravelsshlaravel-envoy

Laravel "envoy run" command not working with ssh key


I am running following command in a laravel project folder and getting following error.

rakib$ envoy run list --env=production
[ubuntu@54.187.123.4]: Permission denied (publickey).

But I can successfully ssh using following command:

ssh -i ~/.ssh/sw-new.pem ubuntu@54.187.123.4

My ~/.ssh/config file content looks like:

Host 54.187.123.4
    IdentityFile ~/.ssh/sw-new.pem

Can anyone suggest me what is the possible reason of getting "Permission denied" error?


Solution

  • It's possible that envoy is using the wrong user when attempting to ssh into the production server. Specify a user in your ~/.ssh/config file:

    Host 54.187.123.4
        IdentityFile ~/.ssh/sw-new.pem
        User ubuntu
    

    That should work.