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
• 18,060 points

3 answers to this question.

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


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

Java filename
answered Jul 2, 2018 by Kalgi
• 51,890 points
0 votes
Hey @Hannah, running bash 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 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

Getting below error on Jenkins while creating a Maven Build Job

When you are using ssh to connect, ...READ MORE

answered Sep 3, 2019 in Jenkins by Hari
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,910 points
+1 vote
4 answers

Is there a way to change the Jenkins build number while building a job?

If you have access to the script ...READ MORE

answered May 7, 2019 in Jenkins by Atul
+1 vote
1 answer
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,420 points
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
• 51,890 points
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
• 51,890 points