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.
 

scsi

Verified User
Joined
Aug 19, 2008
Messages
4,695
Well what sort of folder is it a users folder or a generic web folder. Maybe the user has a corrupt cms or something?
 

floyd

Verified User
Joined
Mar 29, 2005
Messages
5,310
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.
 

iceuk626

Verified User
Joined
May 6, 2006
Messages
261
Location
United Kingdom
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" "you@youremail.com" < output.txt
 
Last edited:

R1Lover

Verified User
Joined
Feb 24, 2007
Messages
439
Just install CSF plugin and set it up this way... it's simple and works great.
 
Top