1

I'm using the samba recycle plugin and have the following in my [global] section

recycle:exclude = *.~lock*
recycle:repository = .recycled
recycle:versions = yes
recycle:keeptree = yes
vfs objects = recycle

I would like to disable this feature for a particular share. I've tried putting vfs objects = within the share definition, but this has no effect. I've also tried putting recycle:exclude = * inside the share definition, but this didn't work either. And finally I tried setting (in the [global] section) recycle:exclude_dir = /home/path/to/my/dir/ which looked promising from the man page

I understand how to disable .recycle completely but this is not what I want.

[edit suggested by helpful commenter below!]

The path in question is monitored by a Dropbox daemon. This is why I don't want a Recycle bin - it will effectively cause a 2nd bandwidth-hogging upload, and the .recycled/ copy is unnecessary because Dropbox versions files anyway.

artfulrobot
  • 2,949
  • 13
  • 36
  • 60
  • 1
    Would it be an option to, inside the folder where the plugin keeps your recycle bin, create a folder with the same name as the dropbox one where the plugin has no rights to write on? It would fault out, but at least it would not fill the recycle share with dropbox files... – Bruno Pereira Jul 26 '12 at 18:13
  • Yes, that's an option, but it would be ideal to get the thing to run without errors because I like to use errors to tell me there's something wrong. You're right, this would solve the upload bandwidth issue, though, thanks. – artfulrobot Jul 27 '12 at 20:55
  • Let us hope brain comes out with a better solution, I do not thing its possible only using the recycle bin plugin, but then again we never know all about everything. gl! – Bruno Pereira Jul 27 '12 at 21:28
  • @BrunoPereira actually, your suggestion worked. I had tried 000 but this caused errors as Dropbox could not read the folder, but 555 means samba can't write to it, so there's nothing there for Dropbox to read, but no errors on the dropbox side. – artfulrobot Dec 06 '12 at 14:32

6 Answers6

2

There's a bit of a work around, just assign permissions 000 to the recycle bin folder on your share, it will still be there, but no files will be written into it. I had to do this on my backups folder, because Windows writes and then deletes so many files backing up.

PosiCat
  • 36
  • 2
  • 000 causes errors as Dropbox could not read the folder, but 555 means Dropbox won't error but samba won't write files to it. Works for me, thanks. – artfulrobot Dec 06 '12 at 14:33
2

Just put inside the share definition:

    recycle:exclude = *.*

At least that worked for me using Samba 4.1.17, on a Debian 8.0 x86_64 machine.

What happened to me

I activated Samba's recycle bin for all of the shares on a file server of us at work. For example:

[global]

...

    recycle:exclude = *.tmp, *.log, *.obj, ~*.*, *.bak, *.iso
    recycle:exclude_dir = tmp, cache
    recycle:keeptree = yes
    recycle:repository = /var/samba/trash/%S
    recycle:versions = yes

...

And I've set up a RECYCLE share, just to make it easy to recover accidentally deleted files:

[RECYCLE]
    path = /var/samba/trash
    writable = yes

Then I realized that if, from a client machine, I deleted a file from any share, and then cut and paste that file from the RECYCLE share to its original share, Samba created a backup of the RECYCLE share with the recovered file inside of it (i.e. a recycle bin of the recycle bin itself).

The solution I found to that was excluding the RECYCLE share from the Samba recycle bin feature:

[global]

...

    recycle:exclude = *.tmp, *.log, *.obj, ~*.*, *.bak, *.iso
    recycle:exclude_dir = tmp, cache
    recycle:keeptree = yes
    recycle:repository = /var/samba/trash/%S
    recycle:versions = yes

...

[RECYCLE]
    path = /var/samba/trash
    recycle:exclude = *.*
    writable = yes
1

I do not think this is possible only for 1 share using the samba recycle bin plugin, you might be better off with a scrip used in cron running every minute or so that clears up that folder inside the recycle bin share.

Something like rm -rf /home/path/to/my/dir/* added to cron will save you the trouble of worrying about the samba configuration.

Schedule a job with cron using crontab -e and add the line

*/10 * * * * /bin/rm -rf /home/path/to/my/dir/*

to make it run every 10 minutes and clear anything inside /home/path/to/my/dir/.

Bruno Pereira
  • 309
  • 2
  • 9
  • Yep, could do that normally, thanks for your time + suggestion. Problem is that the folder I don't want to have a recycle bin for is a Dropbox folder. Dropbox versions files anyway, so a recycle bin is wasted bandwidth. It will trigger immediately, so a 10 (or even 1) minute cronjob won't solve the problem. – artfulrobot Jul 26 '12 at 13:59
  • @artfulrobot you should add that to your question so user know what they are facing ;) – Bruno Pereira Jul 26 '12 at 14:03
0

Delete or put # to comment lines in all the recycle vfs options from the [global] section to disable the recycle functions. Now put the vfs options Only in the shares you want to enable it

jmejias
  • 1
  • 1
0

If it really is a limitation of the plugin that it can only work globally, a solution particular to this situation only would be to change the .recycled path to /somewhere/else/ and then, if necessary, symlink to /somewhere/else/... from the other paths. This is obviously messy, and symlinks cause problems in a mixed OS environment (e.g. Linux will try to resolve locally while Windows gets the server to resolve remotely).

artfulrobot
  • 2,949
  • 13
  • 36
  • 60
0

To disable vfs recycle for a particular share, just put this inside the share:

vfs objects =

So to enable vfs recycle for all shares but not for "norecyclebin" your config should look like this:

[global]
...
   vfs objects = recycle
   recycle:repository = RECYCLER
   recycle:keeptree = Yes
   recycle:versions = Yes
   ...


[share]
   ...

[anothershare]
   ...

[norecyclebin]
   ...
   # disable recycle bin for this share
   vfs objects =