Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to find files which were recently accessed by web server?

Using the Unix "FIND" command?

I am getting a lot of SPAM emails because someone's accessing a PHP script in one of my domains but I cannot find out which because I have quite a lot of domains.

So I am hoping to see which PHP file was recently accessed by them via web sites and delete it.

I am on shared hosting plan.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Your web server should be creating a log each time a file is hit - Apache typically stores these in /var/log/apache or /var/log/httpd. These log files have both the URL (from which you should be able to surmise the script) and access time. (And if you can't access the logs directly - which might be the case on shared hosting, ask your provider where they are !!)

Another approach which might help (depending on your software) is to look at the full headers in the email. Some PHP programs give an indication as to what domain directed the email be sent.

share|improve this answer
    
Is it possible to use Linux find command? I have a lot of domains and each domain has its own log files. –  Scott Feb 14 '13 at 0:20
    
I think that would depend on the filesystem etc, and is not a good way to do it, but you could try find /path/to/html -atime -X where X is the number of days. –  davidgo Feb 14 '13 at 1:32

Installing web analytic software to monitor your websites is your best bet, and if you do that now you'll notice it as soon as it happens again,and even how they're getting there!

On a side note I would recommend securing scripts like that using .htaccess rules.

Hope this helps!

(Edited for better wording.)

share|improve this answer

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.