如何使用tty运行Envoy任务?

时间:2022-06-29 00:05:04

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.

我正在使用Laravel的Envoy库进行部署。当我到达部署结束时,我需要更改一堆文件的所有权;为了做到这一点,我需要切换到root用户,因为chown和chmod不能作为非特权用户。

How do I get Envoy to run a specific server using a tty so that sudo chown ... will work?

如何使用tty让Envoy运行特定的服务器,以便sudo chown ...可以工作?

Here's a link to my Envoy.blade.php file.

这是我的Envoy.blade.php文件的链接。

1 个解决方案

#1


I used the following code to run privileged commands through envoy. I'll give a chown example but add what you want after -S

我使用以下代码通过envoy运行特权命令。我将给出一个chown示例,但在-S之后添加您想要的内容

@task('mytask', ['on' => 'myserver'])
    echo "{{ $password}}" | sudo -S chown 644 /myfile
@endtask

And run with

并运行

envoy run mytask --password=mypass

#1


I used the following code to run privileged commands through envoy. I'll give a chown example but add what you want after -S

我使用以下代码通过envoy运行特权命令。我将给出一个chown示例,但在-S之后添加您想要的内容

@task('mytask', ['on' => 'myserver'])
    echo "{{ $password}}" | sudo -S chown 644 /myfile
@endtask

And run with

并运行

envoy run mytask --password=mypass