Run Laravel Envoy as root

485 Views Asked by At

How can I run Envoy as root? I have a company server which has root access disabled, but I can sudo -s to it.

For example, when running git pull through Envoy I am getting:

[jenkins]: error: cannot open .git/FETCH_HEAD: Permission denied

I have tried adding sudo -s to it:

@task('deploy')

sudo -s
git pull

@endtask

But this only results in:

[jenkins]: sudo: no tty present and no askpass program specified

Is there a way to run Envoy as root?

1

There are 1 best solutions below

6
SviesusAlus On

Just log in to the server as root

@servers(['web' => '[email protected]'])

But logging in as root and running commands is not the most secure way. At least disable password login for root after setting up ssh keys.

In perfect world, you should have a user which can run commands needed for deployment only.