Author Topic: Add Recycle Bin to samba shares  (Read 9515 times)

francesco_r

  • Zen Apprentice
  • *
  • Posts: 24
  • Karma: +1/-0
    • View Profile
Add Recycle Bin to samba shares
« on: December 15, 2008, 03:06:58 pm »
This little guide explain how to add an hidden .recycle folder in top of each samba share.

Code: [Select]
sudo nano /usr/share/ebox/stubs/samba/smb.conf.mas
Add in each section of [home] , [<% $group->{'sharename'} %>] and [<% $share->{share} %>] after the browseable row this:

Code: [Select]
vfs object = recycle
recycle:keeptree = Yes
recycle:versions = Yes
recycle:touch = Yes
recycle:maxsize = 500000000
recycle:exclude = *.tmp|*.temp|*.o|*.obj|~$*|*.~??

Do some changes in the samba ebox module so it rewrite the smb.conf.

With the above settings the recycle bin will not save the files above 500MB. See the samba manual for other useful settings: http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/VFS.html#id2644353

Add a script to /etc/cron.daily to delete the files after 30days of deletion:
Code: [Select]
sudo nano /etc/cron.daily/purge_samba_recycleand write in it:
Code: [Select]
#!/bin/sh
#
find /home/samba/*/*/.recycle/* -atime 30 | xargs rm -rf

Make the script executable
Code: [Select]
sudo chmod +x /etc/cron.daily/purge_samba_recycle

Francesco

PS: remember to rewrite these mods if you update the samba ebox module
« Last Edit: December 16, 2008, 07:55:04 pm by francesco_r »

francesco_r

  • Zen Apprentice
  • *
  • Posts: 24
  • Karma: +1/-0
    • View Profile
Re: Add Recycle Bin to samba shares
« Reply #1 on: January 20, 2009, 01:08:26 pm »
There is an error in the script
Code: [Select]
/etc/cron.daily/purge_samba_recycle"xargs -rf"  don't delete file names with space. So modify to:
Code: [Select]
#!/bin/sh
#
find /home/*/*/.recycle/* -atime 30 -exec rm {} \;

It's slower but works.

Handeich

  • Zen Apprentice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Add Recycle Bin to samba shares
« Reply #2 on: January 21, 2009, 12:14:28 pm »
There is an error in the script...

You're right - thanks for the post!
I found the error yesterday, too - but I have searched a while... ;-)

Another thing: it seems, that my configuration ignores the "recycle:maxsize" parameter (also files over the specified size are copied into the .recycle folder).

Do you have any suggestions to that?

c4rdinal

  • Zen Samurai
  • ****
  • Posts: 341
  • Karma: +4/-0
    • View Profile
Re: Add Recycle Bin to samba shares
« Reply #3 on: March 26, 2009, 02:47:58 am »
Hi,

Does the Ebox 1.0 support this?

TIA

sixstone

  • Zentyal Staff
  • Zen Hero
  • *****
  • Posts: 1417
  • Karma: +26/-0
    • View Profile
    • Sixstone's blog
Re: Add Recycle Bin to samba shares
« Reply #4 on: March 30, 2009, 04:57:43 pm »
I'm afraid to tell you that it is not. :(

Best regards,
My secret is my silence...