1

How would you monitor a directory on a Linux machine to check if there was a user (or someone from the network) who attempted to access it?

0

2 Answers 2

3

inotify like so

inotifywait -m -e modify,create,delete -r /var/www >> /var/log/i-see-www 2>&1

assuming you meant "worked in" when you said "access", simply listing or reading files .. that'd be harder to do.

3

You can use auditd (audit) to monitor file access , after starting the service a log file will be registered under /var/log/audit/audit.log

To set a watch on a file, run :

sudo auditctl -w /path/to/file

To check it , run:

sudo ausearch -f /path/to/file

A detailled tuto can be found on Arch-linux-Wiki

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.