I spend several days setting up the file /etc/sudoers
to be able to give permissions to root to the user jenkins
. I have Jenkins installed on my server
This is just a response to elaborate on the steps to take to fix the issue.
First thing, figure out which user Jenkins GUI is using to execute the bash shell script.
select the project > Configure > enter whoami
in the executable shell > save and Build Now.
View result in build history > click console output
User may be tomcat or jenkins or whatever.
SSH into Jenkins server
sudo su
visudo
tomcat ALL=(ALL) NOPASSWD: ALL
#if user displayed is tomcat