I am trying to build a Git project using Jenkins on an ec2 instance. The custom workspace address I want to keep is /home/ec2-user/xyz.

I get the following error:

java.io.IOException: Failed to mkdirs:

I figured that this is due to permission, that 'jenkins' user doesn't have the permission to that folder.

So, I changed the ownership of xyz, and added jenkins as a user and a group, and tried to change the permission to 777.

Still the error persists.

I tried building this in other /var/www/ and it builds correctly.

Any suggestions?


The problem might be that you gave permission to the xyz directory but did not give write permission to /home as well. You'd have to change the group of /home to jenkins and give it 775 permission.

However, the cleanest way would be to use the default values for Jenkins directories.

  • I had considered that option, but rejected it because /var(for which the build was successful) had the same permissions and owners as /home. Anyway I tried and it worked, although there was a problem with cleaning the directory – Mayank Jan 26 '17 at 9:11
  • on a similar note if a parent directory does not have the required ownership or permission and child directory does have both. Does it work? – Mayank Jan 26 '17 at 9:12
  • No, all traversed directories from / to destination need to have the correct ownership/permission. – dr01 Jan 26 '17 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.