I'm using a Jenkins job to execute some shell commands where directories and files need to be created but I get a Permission Denied error. I'm running Jenkins as a daemon (followed this tutorial from the Jenkins website). The jenkins that runs the job is user jenkins and has group nogroup. The commands create folder1/folder2 which each have a number of files in both. When I use chown for both of them to be jenkins, the permission error goes away and all the files get produced, so this works but is there a way I can set it up so that I don't need to manually create folder1/folder2 and change ownership to jenkins ahead of time?


You need to create a parent folder that belongs to jenkins:nogroup. My guess is that your script is attempting to create folder1 and folder2 inside a parent directory which does not belong to the jenkins user. As long as Jenkins has permissions to write to the parent folder your script should be able to create any directories or files that are required for your tests.

| improve this answer | |
  • I'm not very familiar with this, so I have a few questions. Did you mean to change the parent directory to be owned by jenkins and belong to group nogroup? Everything currently belongs to me, boose, if I made that change how would that affect me cd'ing into directories and reading files, etc? Also the parent directory would be trunk (trunk/folder1/folder2), do I need to do anything to trunk's parent? Thanks a lot – a.boose Jul 31 '12 at 1:51

Yes this can be done. Try using chmod command (http://www.computerhope.com/unix/uchmod.htm), this might help you. I believe this is because of the operating system and not because of Jenkins. Try finding out the answers in Unix forum also. : )

| improve this answer | |

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.