Search code examples
linuxsecurityfile-permissions

Permissions for folders containing temporary files


I am working on a project that allows a user to generate some results. These results are written to a tmp directory and offered as a download to the user. Another process also reads generated XML from that tmp directory to display some values, and a Perl script also scans and loops through that XML file. The XML file and the results file are unique per session.

I also write away user statistics to a logs directory. It contains two files, gen-xml.txt, input.txt. On each user query some information is appended to each file.

I figured that I'd set permissions to 777, but this post got me worried. Does this result in a security issue, and if so, how can I remedy that without losing functionality?


Solution

  • If you need read-only access to the generated files, a 644 permission to the files should do it.

    This will give the owner of the file a read-write access, but read-only permissions to everybody else.

    Here is an excellent tutorial on how Linux permissions work