Koozali.org: home of the SME Server

Deleted Files

Offline Markt606

  • 15
  • +0/-0
Deleted Files
« on: January 25, 2018, 02:08:32 PM »
Someone has deleted a number of random files on an iBay. I suspect they are doing this by mistake.

Is there any way I can find out who has deleted the files?

Offline Stefano

  • *
  • 10,839
  • +2/-0
Re: Deleted Files
« Reply #1 on: January 25, 2018, 03:07:03 PM »

Offline Markt606

  • 15
  • +0/-0
Re: Deleted Files
« Reply #2 on: January 25, 2018, 03:13:23 PM »
Thanks. I don't have that enabled. I will have a look at it and try turning it on.

Is it he Audit variable that needs to be enabled there? Once it is on how would I view the results?

Offline Stefano

  • *
  • 10,839
  • +2/-0

Offline Markt606

  • 15
  • +0/-0
Re: Deleted Files
« Reply #4 on: January 25, 2018, 05:23:46 PM »
I have enabled auditing and have also enabled Recycle Bin but I cant see the results of either one?

Do I have to restart the server to activate them?

thx


Offline Jean-Philippe Pialasse

  • *
  • 2,772
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Deleted Files
« Reply #5 on: January 25, 2018, 06:59:05 PM »
I have enabled auditing and have also enabled Recycle Bin but I cant see the results of either one?

Do I have to restart the server to activate them?

thx
signal-event ibay-modify
should be enough as what you need to restart is samba


Offline Markt606

  • 15
  • +0/-0
Re: Deleted Files
« Reply #6 on: February 01, 2018, 05:43:12 PM »
Im still having some problems with this.

I have an IBay called "cont_dept"

so I have gone in as root and entered the following:

    db account setprop cont_dept Audit enabled
    signal-event ibay-modify cont_dept

under /var/log/samba I can see a file called samba_audit  but its empty.

I have attached a couple of screenshots. Can you see if I am doing something wrong please?

Thank you


Offline mmccarn

  • *
  • 2,628
  • +10/-0
Re: Deleted Files
« Reply #7 on: February 03, 2018, 02:13:55 PM »
You could check in /etc/samba/smb.conf to make sure that the audit logging entries have been created.

I did this:
Code: [Select]
cp /etc/samba/smb.conf /etc/samba/smb.conf-
db accounts setprop Primary Audit enabled
signal-event ibay-modify Primary
diff -u /etc/samba/smb.conf /etc/samba/smb.conf-

The results looked like this (sorry - I 'diffed' them in the wrong order, so the new content is marked with a minus):
Code: [Select]
diff -u /etc/samba/smb.conf /etc/samba/smb.conf-
--- /etc/samba/smb.conf 2018-02-03 07:51:52.966527426 -0500
+++ /etc/samba/smb.conf- 2018-02-03 07:41:50.807661212 -0500
@@ -153,12 +153,6 @@
 
 
 
-vfs objects = full_audit
-  full_audit:priority=notice
-  full_audit:success=opendir mkdir rmdir open write rename unlink
-  full_audit:failure=connect
-  full_audit:facility=local5
-  full_audit:prefix=%u|%I|%S
 
(with the new content in the section related to '[Primary]').

As soon as I accessed the Primary i-bay using samba from my macbook, the audit log was populated:
Code: [Select]
tail /var/log/samba/tail samba_audit
Feb  3 07:52:13 office smbd[27499]: mmccarn|192.168.200.110|Primary|opendir|ok|.
Feb  3 07:52:13 office smbd[27499]: mmccarn|192.168.200.110|Primary|opendir|ok|.
Feb  3 07:52:13 office smbd[27499]: mmccarn|192.168.200.110|Primary|opendir|ok|.
Feb  3 07:52:13 office smbd[27499]: mmccarn|192.168.200.110|Primary|opendir|ok|.
Feb  3 07:52:18 office smbd[27499]: mmccarn|192.168.200.110|Primary|opendir|ok|.
Feb  3 07:52:18 office smbd[27499]: mmccarn|192.168.200.110|Primary|opendir|ok|.
Feb  3 07:52:18 office smbd[27499]: mmccarn|192.168.200.110|Primary|opendir|ok|.
Feb  3 07:52:23 office smbd[27499]: mmccarn|192.168.200.110|Primary|opendir|ok|.
Feb  3 07:52:23 office smbd[27499]: mmccarn|192.168.200.110|Primary|opendir|ok|.
Feb  3 07:52:23 office smbd[27499]: mmccarn|192.168.200.110|Primary|opendir|ok|.

The same procedure didn't work on another "ibay" -- until I realized that the other ibay was actually a user account.

Adding the 'full_audit' directives shown above to the [homes] section of /etc/samba/smb.conf, then restarting smbd (sv t smbd) started generating samba_audit entries when I access my user folder.  You'd need a custom copy of /etc/samba/smb.conf/50homes if you wanted to enable audit logging on user folders persistently.

Offline MSmith

  • *
  • 675
  • +0/-0
Re: Deleted Files
« Reply #8 on: March 09, 2018, 12:39:12 AM »
Just to clarify, please, no offense intended ... turning on either Recycle Bin or the Linux equivalent of "shadow copy" at this point will NOT repeat NOT allow you to recover files deleted in the past.
...