Zentyal Forum, Linux Small Business Server

Zentyal Server => Installation and Upgrades => Topic started by: francesco_r on December 15, 2008, 03:06:58 pm

Title: Add Recycle Bin to samba shares
Post by: francesco_r 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
Title: Re: Add Recycle Bin to samba shares
Post by: francesco_r 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.
Title: Re: Add Recycle Bin to samba shares
Post by: Handeich 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?
Title: Re: Add Recycle Bin to samba shares
Post by: c4rdinal on March 26, 2009, 02:47:58 am
Hi,

Does the Ebox 1.0 support this?

TIA
Title: Re: Add Recycle Bin to samba shares
Post by: sixstone on March 30, 2009, 04:57:43 pm
I'm afraid to tell you that it is not. :(

Best regards,