6

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.

Goldentoa11
  • 1,700
  • 2
  • 17
  • 29

1 Answers1

4

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
Dave Carruthers
  • 542
  • 1
  • 8
  • 29