Log for deleted files

Is there ay way to check if user delete any files or folders? I mean log in user, it would be perfect if I can (admin) see all deleting action.

MacBook Pro (Penryn) / Mac Pro, Mac OS X (10.5.6), MBPro 2,4GHz / 200GB / 4GB | Mac Pro 2x2.0 / 750 GB / 10 GB / 8800GT

Posted on Nov 18, 2010 12:04 AM

Reply
7 replies

Nov 19, 2010 4:15 PM in response to Night Slash

You could also create a wrapper script. And replace /bin/rm with it. So that if a user
on the system run 'rm' to remove files, the entry would be written to a log file of you
choice. The following is a quick hack.


#!/bin/bash
PS=/bin/ps
PS_OPTIONS=" -p $$ -o uid=EffectiveUser,user,ruid=RealUserName,ruser,args,uid"
ECHO=/bin/echo
RM=/bin/rm.real # The real rm(1) command.
LOGFILE=/tmp/hold
${PS} ${PS_OPTIONS} >> ${LOGFILE}
${RM} ${1}




$ rm testfile1
$ cat /tmp/hold
EffectiveUser USER RealUserName RUSER ARGS UID
501 andya 501 andya /bin/bash rm testfile1 501

Nov 19, 2010 12:39 PM in response to Night Slash

Have a look at the Common Criteria Tools and the auditing discussed starting on [page 370 here|http://images.apple.com/server/macosx/docs/ServerSecurity_Configv10.6.pdf], and the auditing chapter starting on [page 57 here|https://ssl.apple.com/support/security/commoncriteria/CommonCriteriaAdminG uide.pdf], and have a look at the auditing and audit_class man pages. (For practical purposes, delete access is the same as write access; write and overwrite and delete aren't particularly different.)

Nov 20, 2010 4:48 PM in response to Nils C. Anderson

That would only log invocations of rm in a shell, and then only by the first user to invoke it, unless the log file were created in advance with suitable permissions. There are other ways to delete a file, including a really strange one that I use occasionally: moving it to the Trash in the Finder and emptying. But I may be the only person who does such weird things.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Log for deleted files

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.