File Access Monitoring

From Indie IT Wiki
Jump to: navigation, search

InCron

Install software...

sudo aptitude install -y -v incron

Allow normal users...

sudo nano /etc/incron.allow

Create a Incrontab to monitor a folder...

incrontab -e

Add the lines like this...

/home/user/Folder/ IN_MODIFY /usr/local/bin/incronotify "$#"

Save and exit the Incrontab editor.

Create the notification shell script of your choosing...

sudo touch /usr/local/bin/incronotify
sudo chmod +x /usr/local/bin/incronotify
sudo nano /usr/local/bin/incronotify

echo "$@" |mail -s "Change in folder" me@mydomain.com

Then test it!

http://www.cyberciti.biz/faq/linux-inotify-examples-to-replicate-directories/

https://www.howtoforge.com/triggering-commands-on-file-or-directory-changes-with-incron

http://inotify.aiken.cz/?section=incron&page=doc&lang=en

Custom Script

See this article.