本文介绍了如何在Jenkins中以根用户身份运行脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在Jenkins中以root身份而不是默认用户身份运行Shell脚本.我需要更改什么?
I need to run a shell script in Jenkins as root instead of the default user. What do I need to change?
我的sudoers文件是这样的:
My sudoers file is like this:
# User privilege specification root ALL=(ALL) ALL igx ALL=(ALL) ALL %wheel ALL=(ALL) ALL # Allow members of group sudo to execute any command # (Note that later entries override this, so you might need to move %sudo ALL=(ALL) ALL # #includedir /etc/sudoers.d # Members of the admin group may gain root privileges %admin ALL=(ALL) NOPASSWD:ALL root ALL=(ALL) ALL jenkins ALL=NOPASSWD: /var/lib/jenkins/workspace/ing00112/trunk/source/ jenkins ALL=(ALL) NOPASSWD:ALL #Defaults:jenkins !requiretty推荐答案
您必须使用sudo运行脚本:
sudo /path/to/script但是在您必须允许jenkins在/etc/sudoers中运行脚本之前.
But before you must allow jenkins to run the script in /etc/sudoers.
jenkins ALL = NOPASSWD: /path/to/script更多推荐
如何在Jenkins中以根用户身份运行脚本?
发布评论