Permission denied error while running a simple job in Jenkins

+2 votes
Permission denied error while running a simple job in Jenkins

I was trying to build a simple java program on Jenkins and while doing so I got an error saying

“Permission denied

Execute shell marked built as failure”
Jul 2, 2018 in Jenkins by Hannah
• 14,040 points
2,807 views

3 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
This error only occurs when jenkins does not have permission as a sudo user on the linux machine.

This works completely fine on windows but in linux you need to provide sudo permissions.

To get over the error follow these steps:

Step 1: open terminal

Step 2: $sudo nano /etc/sudousers

Step 3: at the end of the file add

Jenkins ALL=(ALL) NOPASSWD:ALL

Save and exit

Step 4: on your jenkins page, go to your job->configure->build triggers->build periodically and add sudo in front of your compile statement

It’ll look like this

Cd /file_path/

Sudo javac filename.java

Java filename
answered Jul 2, 2018 by Kalgi
• 35,640 points
0 votes
Hey @Hannah, running bash command.sh worked for me, you can try it too. But I feel @Kalgi's answer seems more explanatory and even that works perfectly fine, i would suggest using that solution.
answered Oct 25, 2018 by Haider
How did running bash command.sh work? What exactly did you do?
0 votes
Hey @Hannah, try changing the permissions using chmod, for me it gave this error because it didn't have the required permissions.
answered Oct 25, 2018 by krishti
Changing permission using chmod worked for me. Thanks

Related Questions In Jenkins

0 votes
1 answer

running a Jenkins job on multiple virtual servers.

Your goals can be achieved by using ...READ MORE

answered May 25, 2018 in Jenkins by shubham
• 6,480 points
74 views
+1 vote
4 answers
+1 vote
1 answer
0 votes
1 answer

How can I create global macros and templates in jenkins job builder?

you can append the path to the ...READ MORE

answered Apr 2, 2018 in Jenkins by ajs3033
• 7,000 points
187 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

Jenkins cannot open directory Permission denied

Try whoami command to find out which ...READ MORE

answered Aug 8, 2018 in Jenkins by Kalgi
• 35,640 points
150 views
0 votes
1 answer

Set a Jenkins environment variable based on a job parameter

So if you give choice parameter the ...READ MORE

answered Aug 14, 2018 in Jenkins by Kalgi
• 35,640 points
293 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.