Skip to content

Allow gitlab-runner service to execute as a different user

Problem

When the use run gitlab-runenr install the gitab-runner process is started as root, so any command, tool that it executed runs as root. This can be a problem for example for the Virtualbox executor where it executor vboxmange as root. We should allow users to specify a user under with gitlab-runner gets executed as.

Original report

When GitLab Runner is installed as a service on Linux, any configured VirtualBox runners will run as root regardless of the value of the --user option specified at service installation time. Any vulnerabilities in VirtualBox that could allow possible code execution on the host system could in turn allow root access if this is left as-is.

Edited by Steve Xuereb