2016-07-22 89 views
0

我試圖讓詹金斯有運行此命令工作sudo訪問:無法允許詹金斯爲shell腳本

sudo -n sh /opt/sonar/bin/linux-x86-64/sonar.sh start 

我一直在使用visudo命令,這樣我添加以下行對我的CentOS editied機:

jenkins ALL=(ALL)  NOPASSWD: /opt/sonar/bin/linux-x86-64/sonar.sh 

然而,當我跑,他的工作我仍然得到:

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 

我缺少什麼樣的配置?

+0

相關:http://askubuntu.com/questions/192050/how-to-run-sudo-command-with-no-password – Jayan

回答

0

試試這個;

Cmnd_Alias  CUSTOM_CMD=/opt/sonar/bin/linux-x86-64/sonar.sh 
jenkins  ALL = (root) NOPASSWD:CUSTOM_CMD 
+0

還是一樣。 – mangusbrother