java nio file AccessDeniedException root home

0 votes

Hi Guys,

I have changed Jenkins home directory. But it showing me the below error, when I run any job.

Building in workspace /root/home
java.nio.file.AccessDeniedException: /root/kubectl
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384)
at java.nio.file.Files.createDirectory(Files.java:674)
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
at java.nio.file.Files.createDirectories(Files.java:767)
at hudson.FilePath.mkdirs(FilePath.java:3256)
at hudson.FilePath.access$1300(FilePath.java:211)
at hudson.FilePath$Mkdirs.invoke(FilePath.java:1251)
at hudson.FilePath$Mkdirs.invoke(FilePath.java:1247)
at hudson.FilePath.act(FilePath.java:1075)
at hudson.FilePath.act(FilePath.java:1058)
at hudson.FilePath.mkdirs(FilePath.java:1243)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1200)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
at hudson.model.Run.execute(Run.java:1856)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:428)
Finished: FAILURE

How can I solve this error?

Jun 4, 2020 in Jenkins by akhtar
• 38,230 points
11,927 views

1 answer to this question.

0 votes

Hi@akhtar,

By default Jenkins home directory is set to /var/lib/jenkins folder. But if you want to change Jenkins home directory then you have to use root user. Follow the below given steps.

  • Open Jenkins configuration file.
$ vi /etc/sysconfig/jenins
  • Change Jenkins home directory and Jenkins user as root.

  • Restart Jenkins service.

$ systemctl restart jenkins

Hope it helps!!

If you need to know more about Java, join our Java online course today.

Thank you

answered Jun 4, 2020 by MD
• 95,440 points

Related Questions In Jenkins

+5 votes
5 answers

Jenkins properties file

Follow these steps: 1. Install ‘EnvInject’ plug-in in the Jenkins ...READ MORE

answered Aug 2, 2018 in Jenkins by lina
• 8,220 points
27,456 views
0 votes
1 answer

unable to compile java code in Jenkins

If the code is compiling and running ...READ MORE

answered Apr 25, 2018 in Jenkins by DareDev
• 6,890 points
2,090 views
0 votes
2 answers
+1 vote
3 answers

Rename jobs from jenkins file

Go to the Configure screen and edit the Project name field ...READ MORE

answered Oct 25, 2018 in Jenkins by Laila
4,161 views
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,504 views
+2 votes
1 answer
0 votes
1 answer

/tmp/jenkins6403305246799294208.sh: line 2: cd: /root: Permission denied

Hi@akhtar, You are getting permission denied because you ...READ MORE

answered Feb 6, 2020 in Jenkins by MD
• 95,440 points
2,781 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP