shell – 如何在Jenkins中以root身份运行脚本?
发布时间:2020-12-15 09:18:43 所属栏目:安全 来源:网络整理
导读:我需要运行一个shell脚本在Jenkins作为根,而不是默认用户。我需要改变什么? 我的sudoers文件是这样的: # User privilege specificationroot ALL=(ALL) ALLigx ALL=(ALL) ALL%wheel ALL=(ALL) ALL# Allow members of group sudo to execute any command# (
我需要运行一个shell脚本在Jenkins作为根,而不是默认用户。我需要改变什么?
我的sudoers文件是这样的: # 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中的脚本之前。 jenkins ALL = NOPASSWD: /path/to/script (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |