I'm using Laravel's Envoy library for deployment. When I get to the end of deployment, I need to change a bunch of files' ownership; in order to do this, I need to switch to the root user, because chown
and chmod
don't work as an unprivileged user.
How do I get Envoy to run a specific server using a tty so that sudo chown ...
will work?
Here's a link to my Envoy.blade.php file.
I used the following code to run privileged commands through envoy. I'll give a chown example but add what you want after -S
@task('mytask', ['on' => 'myserver'])
echo "{{ $password}}" | sudo -S chown 644 /myfile
@endtask
And run with
envoy run mytask --password=mypass
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With