?
Solved

How to protect a file on the web host

Posted on 2008-11-08
3
Medium Priority
?
227 Views
Last Modified: 2013-11-19
I have a PHP script that updates a counter in a file on my website.  Someone recently got into that sub-directory and destroyed the file.  I need to be able to allow users to execute the script, but not allow anybody into the directory so they can farkle things up.

How do I do this?
0
Comment
Question by:rmmarsh
3 Comments
 
LVL 4

Assisted Solution

by:futurefiles
futurefiles earned 450 total points
ID: 22912758
whats the OS? if its windows then you can change the ntfs pernissions to read and execute, if its linux i think you need to chmod the file
0
 
LVL 12

Accepted Solution

by:
jazzIIIlove earned 600 total points
ID: 22912776
Could you give the server specification? A linux server or a windows server?

If Linux, the give only the 755 right to the directory with its contents...

You can change permissions for all files and directories within a directory by using the -R option on the chmod command. For example, to setup others read and execute access to all files and directories (and files and directories within directories), you need to type command as follows (i.e. change the modes of the file hierarchies rooted in the files instead of just the files themselves):
# chmod -R 755 directory-name/

Files that you create in the public_html dir must have at least permissions
644 (directories must be 755) or the WWW server will not be able to read
them and they will not be "on the World Wide Web".

Best regards...

0
 
LVL 12

Assisted Solution

by:Hugh Fraser
Hugh Fraser earned 450 total points
ID: 22912830
Does the counter file need to be in a directory that's served by the web server? The app that updates it needs to be able to write to it, but it doesn't need to be in a directory that could possibly be accessed through a browser.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
The viewer will learn how to count occurrences of each item in an array.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question