Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to run a github runner as root

I am trying to run my github runner as root for self hosted linux servers. Can anyone point me to easy solution that I can implement quickly in following code:

name: Test
on: push
jobs:
  Test1:
    runs-on: selfhosted-linux # This should run on this self hosted runner only
    steps:
      - uses: actions/checkout@v2

At this point I cannot ssh into the selfhoste linux but can access it only via code in the workflow folder and I would like to run the checkout as root rather then non root user.

like image 857
10raw Avatar asked Jul 20 '26 09:07

10raw


2 Answers

You need to set the environment variable RUNNER_ALLOW_RUNASROOT before you run config.sh to set up the runner. e.g.

RUNNER_ALLOW_RUNASROOT=1 ./config.sh --token asdlkjfasdlkj

like image 131
Leopd Avatar answered Jul 24 '26 21:07

Leopd


You can easily install the service as root after you configure your runner. e.g

sudo ./svc.sh install root

if you have an existing runner then:

# uninstall existing service
sudo ./svc.sh uninstall

#then re-install as root user
sudo ./svc.sh install root
like image 39
Olamide226 Avatar answered Jul 24 '26 21:07

Olamide226



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!