samba disk-space-utilization – How to Disable .recycle Feature for Samba Shares

disk-space-utilizationsamba

I had a pretty big scare when my company file server filled up.

after tacking down the source I discovered that there is a .recycle folder that keeps ALL the files ever deleted (which is also hidden)

Is there anyway to disable this feature?

or periodically run a command that will delete all the junk?

Edit

example of my smb.conf

 [homes]
            comment = Home
            path = /home/%S/smbhome
            browseable = no
            writable = yes
            read only = no

 -->*          veto files = /.recycle/
 -->           vfs objects = recycle
 -->                   recycle:keeptree=True
 -->                   recycle:versions=True
 -->                   recycle:touch=True
            hide dot files = yes

            force directory mode = 0770
            force create mode = 0660
            force group = grp-it

            valid users = @grp-it, %S
            invalid users =

Should i just comment out these lines.

what about VETO files? (marked *)

Best Answer

You have got the Samba Recycle plugin configured. This copies files to a .recycle directory when they are deleted through a Samba share.

The plugin is enabled using the vfs objects share configuration option in smb.conf. To disable it find the vfs objects configuration options and remove recycle from the value (or remove the option completely if it only references recycle). You'll also want to get rid of any options that are prefixed recycle:.

We use a daily cron job like the following to delete files in .recycle older than 10 days and clean up empty directories:

#!/bin/sh

for d in /home/*/.recycle 
do
  if [ -d "$d" ]
  then
    tmpreaper --mtime-dir --symlinks 10d "$d"
    find "$d" -depth -mindepth 1 -type d -print0 | xargs --null --no-run-if-empty rmdir --ignore-fail-on-non-empty
  fi
done

This script uses the tmpreaper package.

The veto files option is preventing users from seeing or accessing the .recycle directories through the file shares.

If you want to disable the Recycle plugin, then either remove or comment out all the lines that you have highlighted apart from the veto files line. To allow users to see and access directories named .recycle, then remove or comment out the veto files line too.