Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

So the client I am working for right now is really big on load time speed, so we try to shave every micro second possible. We found a file the other day that was pulling some word press blogs and it was adding a solid second to the load time.

Now I didn't write that particular script and perhaps I can go optimize it later, but for now, what I did was make a script that writes the output of the wp script to another file, then I simply reference that file when we need it. We run a cron on the script I wrote so it checks the wp script every so often and outputs any updates if needed.

That obviously really made things faster but I just have never done it before so I am curious about it:

  • obviously we have a file with 777 permissions, what are my security concerns for this?
  • Is this a good strategy to cut down in the future when the processing doesn't have to be done at the time of load?
share|improve this question
    
Related: programmers.stackexchange.com/q/137860/34530 –  todofixthis Mar 9 '12 at 15:22

1 Answer 1

up vote 5 down vote accepted

you shouldn't have 777 permissions on that file. change the file to be owned by the user your apache (or whatever webserver you're using) is running (for example wwwrun.www on suse linux or www-data.www on ubuntu). after this you can give read and write permissions just to that user (644) - you don't need permissions for executing at all.

EDIT:
the commands to do this are

  • chown wwwrun.www myfile.txt to change the owning user (wwwrun) and user-group (www)
  • chmod 644 myfile.txt to change the permissions (6 = read/write for owner, 44 = just reading for everyone else)
share|improve this answer
    
I may need a little clarification on how to do this. Obviously changing permissions is not an issue, but I am unclear on "change the file to be owned by the user your apache is running" Learning something new every day, still very green on some of this server stuff. –  absentx Mar 8 '12 at 6:55
    
please see my edit and don't hesitate to ask if anything else remained unclear –  oezi Mar 8 '12 at 7:04
    
excellent, thanks so much. I'll post more questions if I run into any trouble. –  absentx Mar 8 '12 at 8:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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