简体   繁体   English

以 root 身份运行 Laravel Envoy

[英]Run Laravel Envoy as root

How can I run Envoy as root?如何以 root 身份运行 Envoy? I have a company server which has root access disabled, but I can sudo -s to it.我有一个禁用root访问的公司服务器,但我可以sudo -s访问它。

For example, when running git pull through Envoy I am getting:例如,当通过 Envoy 运行git pull时,我得到:

[jenkins]: error: cannot open.git/FETCH_HEAD: Permission denied [jenkins]:错误:无法打开.git/FETCH_HEAD:权限被拒绝

I have tried adding sudo -s to it:我试过添加sudo -s到它:

@task('deploy')

sudo -s
git pull

@endtask

But this only results in:但这只会导致:

[jenkins]: sudo: no tty present and no askpass program specified [jenkins]:sudo:没有 tty 存在,也没有指定 askpass 程序

Is there a way to run Envoy as root?有没有办法以 root 身份运行 Envoy?

Just log in to the server as root只需以 root 身份登录到服务器

@servers(['web' => 'root@webserver.example.com'])

But logging in as root and running commands is not the most secure way.但以 root 身份登录并运行命令并不是最安全的方式。 At least disable password login for root after setting up ssh keys.设置 ssh 密钥后,至少禁用 root 密码登录。

In perfect world, you should have a user which can run commands needed for deployment only.在完美的世界中,您应该有一个用户可以运行仅部署所需的命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM