[英]Unable to allow sudo access for jenkins for shell script
I am trying to get jenkins to have a job that runs this command: 我正在尝试让詹金斯有一份运行以下命令的工作:
sudo -n sh /opt/sonar/bin/linux-x86-64/sonar.sh start
I have editied using visudo such that I added the following line on my CentOS machine: 我已经使用visudo进行了编辑,以便在CentOS机器上添加了以下行:
jenkins ALL=(ALL) NOPASSWD: /opt/sonar/bin/linux-x86-64/sonar.sh
However when I run he job i still get: 但是,当我运行他的工作时,我仍然得到:
Building on master in workspace /data/jenkins/Start_Sonar_Job/workspace
[workspace] $ /bin/sh -xe /tmp/hudson8942100529506642093.sh
+ sudo -n sh /opt/sonar/bin/linux-x86-64/sonar.sh start
sudo: a password is required
Build step 'Execute shell' marked build as failure
Finished: FAILURE
What configuration am I missing? 我缺少什么配置?
Try this; 尝试这个;
Cmnd_Alias CUSTOM_CMD=/opt/sonar/bin/linux-x86-64/sonar.sh
jenkins ALL = (root) NOPASSWD:CUSTOM_CMD
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.