Jenkins: Permission denied to a 777 file
Asked Answered
C

1

7

I have created a Jenkins build to compile and distribute some modules. The output of the build commands (e.g., make or ant) is redirected to a file named build.log.

The funny thing is that redirecting echo into the very same file, using tee, fails:

tee: ../../build.log: Permission denied

The file exists and has 777 permissions (checked with ls -ltrh ../..). Any ideas what's wrong with this write?

Coating answered 4/6, 2012 at 14:56 Comment(2)
Are you sure the path to the directory has the proper permissions? Not just the file?Chlorate
Are you sure the user running jenkins is the one with the 777 permission?Hardecanute
E
15

Permissions on a file are important, but so are permissions on the super directories of that file.

If you do not have read and execute permissions on the directories you are traversing through, then you cannot follow the relative path to the file. If you lack read permissions on the directory "build.log" resides in, you cannot list the files in that directory. Read, Write, and Execute permissions do matter for directories, and they roughly map to:

  • Read = allows Listing of files
  • Write = allows Creating / Deleting / Modifying files
  • Execute = allows changing directory to this directory
Essene answered 4/6, 2012 at 15:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.