【原文链接】Gitlab----Shell类型的gitlab-runer如何设置以root权限执行

1 编辑修改 /etc/systemd/system/gitlab-runner.service 文件,将 --user 修改为 root

Gitlab----Shell类型的gitlab-runer设置以root权限执行-LMLPHP

2 重启服务

执行如下命令重启 gitlab-runer 服务

systemctl daemon-reload
systemctl restart gitlab-runner

3 确认修改生效

执行如下命令,确认gitlab-runer的执行用户为root

[root@redrose2100 gitlab-runner]# ps -ef |grep gitlab-runner
root      98312      1  0 21:09 ?        00:00:00 /usr/local/bin/gitlab-runner run --working-directory /home/gitlab-runner --config /etc/gitlab-runner/config.toml --service gitlab-runner --user root
root      98322  95992  0 21:14 pts/0    00:00:00 grep --color=auto gitlab-runner

09-18 11:25