New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
How to get alert when a file changes?
Hello,
Is there a way I can get alert when a file (lets say WP theme file) is changed or edited on my server?? I can setup script in server running Centos if there is a way to get email about it.
If we can track any change in directory, that will be even better. But if I have to, I can setup a cron job for every file.
Thanks
Comments
http://aide.sourceforge.net/
Have a look at Wordfence, we use it on a few sites and it seems to be working well over the past month.
@Umair:
inotify-tools and a simple bash script would do the job nicely
If this is pure WP, wordfence is the plugin your after
I use a python inotify-based library at home. It's pyinotify but I need to switch to something else as it has some implementation issues. Maybe this:
https://pypi.python.org/pypi/python-inotify/0.6-test
Question: can you use the kernel's inotify service on all types of VPS? OvZ?
Something I did real quick:
Note that
1) this does not show the changes
2) files added after the initial array population (when the script starts) are not checked
Codeguard is really nice. Every time something changes on your website it makes a backup of it and notifies you.
Tripwire, AFICK, too many to name
Decided to continue my little script I posted in this thread previously and I got a bit carried away.
So, I don't know if anyone cares, since there's probably much more "professional" solutions available, but here's my take on this:
http://git.socials.xyz/diffchecker.git/tree/master/
Here's what it does/is/has:
Edit: Oh, and this script syncs a "master" copy of the directory you want to monitor, so it will take twice as much disk space. So if you're thinking of monitoring your 500GB music collection (why would you, anyway?), don't.
+1 for inotify. I use it on some C-based daemons I run on VPS'.
Install inotify-tools:
apt-get install inotify-tools
For monitoring file changes:
For monitoring folder changes:
Disclaimer: For your information only, use at your own risk.
if you do not want files to change (for example wp theme and plugins) why do not make them read only 444 ?
Because if someone can get through your FTP then 444 doesn't matter anymore.
This is called "File integrity monitoring" and there are several (free) products implementing this, for example AIDE, Tripwire, OSSEC...
I'm sure that 80+% of vps owners here do not install ftp/s server when they have ssh/sftp... It's too much hassle to get something insecure when you have default secure alternative already installed...
And If someone get ssh access file change monitoring does not matter...
There's really two different approaches mentioned here.
One is the inotify-based approach, in which you get notifications via kernel events.
The other is more of an audit/tripwire-esque approach, where you save hashes of files and periodically check them.
The inotify-based approach has many uses. The tripwire-based method I've only seen used in a security context.