0

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?

Norgul
  • 4,613
  • 13
  • 61
  • 144

1 Answers1

0

Just log in to the server as root

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

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.

SviesusAlus
  • 429
  • 4
  • 12
  • Did you miss the "which has root access disabled" part :) ? – Norgul Aug 18 '20 at 09:13
  • no. but needing root to do only `git pull` is way too much. switch project folder owner to the user that you are logging with and allow web server user or group to have access to it. – SviesusAlus Aug 18 '20 at 09:34
  • `git pull` was a single example. There is a lot more going on there. For example Docker deployments require root access as well – Norgul Aug 18 '20 at 09:54
  • So just login as root :) – SviesusAlus Aug 18 '20 at 10:00
  • I can't login as root if root access is disabled. Even if I could, company doesn't give out root credentials around as if they are pop candy – Norgul Aug 18 '20 at 10:48
  • This looks to be a solution, but again you sort of need a password. https://stackoverflow.com/questions/21659637/how-to-fix-sudo-no-tty-present-and-no-askpass-program-specified-error – SviesusAlus Aug 18 '20 at 10:52