script needed

RichardF

Verified User
Joined
Jul 5, 2005
Messages
59
Location
Netherlands
I regularly find files in some user folder with a mail script in it, and it is sending spam out, causing my server to be blacklisted.

So I was thinking if I had a script that checks the home directories for new files and mail me each day which files are created on the server, than I can see quicker if some corrupt script appeared on the server. Normally there aren't many files added/changed each day.

my problem is scripting :) so maybe someone can help me with a script.

or maybe there is a better way to prevent this. Because I notice that these files are allways in folders with 777 permission.

any help tips are welcome.
 
Well what sort of folder is it a users folder or a generic web folder. Maybe the user has a corrupt cms or something?
 
Maybe you could set a cron to send the FTP log by email every 24hrs ?

FTP log will not tell you what was uploaded via a php script which is how these are done most of the time.
 
Ahh good point.

What about a simple shell script that searches /home for files that are under 24hrs old ? then run it via cron every 24hrs and emails the results.

maybe something along these lines:
Code:
find /home/  -type f -mtime -1 >> output.txt

then mail output text to you:

Code:
/bin/mail -s "Latest Files" "[email protected]" < output.txt
 
Last edited:
Just install CSF plugin and set it up this way... it's simple and works great.
 
Back
Top