LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   log access file program (https://www.linuxquestions.org/questions/programming-9/log-access-file-program-843589/)

hamedhsn 11-11-2010 12:27 AM

log access file program
 
hi.
i want to make a program to write the result of access to a file ,i mean for example a user wants to (open,delete,edit)a file but if he has no access to this file ,something write to a log file.
so after that i can check which user got access denied by accessing to which file.
can anybody help me?
or if any tools available that can do this?
or if there is any built in log access file that record the permission denied to files?

any help/hint would be appreciated..
thanks in advance.
i use opensuse11.2

neonsignal 11-11-2010 12:44 AM

You may find the auditd package helpful; you can use auditctl to set up watch rules (see the examples towards the end of the man page).

hamedhsn 11-15-2010 11:49 PM

Quote:

Originally Posted by neonsignal (Post 4155447)
You may find the auditd package helpful; you can use auditctl to set up watch rules (see the examples towards the end of the man page).

thanks for introducing that tool,but i have a problem i found this link http://www.cyberciti.biz/tips/linux-...to-a-file.html
it has really good example ,i can successfully set the rule but when i use ausearch -f /etc/passwd
i got <no match> i tried several rules but no can have result..
can you help me??

hamedhsn 11-18-2010 12:16 AM

i got the answer ,you should start the audit daemon by using auditd -n command.cool isn't it!!
but i want to put watch on every file that a particular user access???

hamedhsn 01-16-2011 11:45 PM

it can also be started by using auditctl -e 1 and ended by auditctl -e 0


All times are GMT -5. The time now is 12:26 AM.