There is a network recycle bin for each share. To set this up, here are the files to configure with the necessary options. My tests were done on a Red Hat Enterprise 4 with Samba 3. This configuration only works with Samba 3. For earlier versions, it’s a .recycle file with a different content. But let’s proceed with the configuration:

Edit the smb.conf file and add these lines:

  vfs objects = recycle
recycle:exclude = *.tmp *.temp *.o *.obj ~$*
recycle:keeptree = True
recycle:touch = True
recycle:versions = True
recycle:noversions = .doc|.xls|.ppt
recycle:repository = .recycle
recycle:maxsize = 0
  

A small script in the crontab to remove items older than 1 week and you’re good to go :-)

  #!/bin/sh #

# This is the name of the Dust bin
recyclename=".recycle"

for dustshare in "/home/data/$recyclename" "/home/sales/$recyclename" "/home/share/$recyclename" ; do
     test -d $dustshare || mkdir $dustshare && chown nobody:nobody $dustshare && chmod 700 $dustshare
     find $dustshare -mtime +168 -exec rm -f {} \;
done
  

Of course, don’t forget to restart Samba!

  /etc/init.d/smbd restart
  

Last updated 22 Oct 2006, 20:28 CEST. history