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(
at sun.nio.fs.UnixException.rethrowAsIOException(
at sun.nio.fs.UnixException.rethrowAsIOException(
at sun.nio.fs.UnixFileSystemProvider.createDirectory(
at java.nio.file.Files.createDirectory(
at java.nio.file.Files.createAndCheckIsDirectory(
at java.nio.file.Files.createDirectories(
at hudson.FilePath.mkdirs(
at hudson.FilePath.access$1300(
at hudson.FilePath$Mkdirs.invoke(
at hudson.FilePath$Mkdirs.invoke(
at hudson.FilePath.act(
at hudson.FilePath.act(
at hudson.FilePath.mkdirs(
at hudson.model.AbstractProject.checkout(
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(
at jenkins.scm.SCMCheckoutStrategy.checkout(
at hudson.model.AbstractBuild$
at hudson.model.Run.execute(
at hudson.model.ResourceController.execute(
Finished: FAILURE

How can I solve this error?

Jun 3, 2020 in Jenkins by akhtar
• 38,170 points

1 answer to this question.

0 votes


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
answered Jun 4, 2020 by MD
• 95,060 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
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
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
+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 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
+2 votes
1 answer
0 votes
1 answer

/tmp/ 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,060 points