Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins: Permission denied to a 777 file

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?

like image 554
Adam Matan Avatar asked Jun 04 '12 14:06

Adam Matan


Video Answer


1 Answers

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
like image 82
Edwin Buck Avatar answered Sep 18 '22 02:09

Edwin Buck