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.


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.

  • Is it possible to use Linux find command? I have a lot of domains and each domain has its own log files. – Scott Yu - Front-End UX 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.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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