Recycle Bin (vfs recycle) for SMB Shares


dlandon

Recommended Posts

18 hours ago, NasOnABudget said:

This is really disappointing to me, as I consider protecting me from myself a really important feature of a nas. This protects you in a way deeper than a backup can.

Couldn't you run a user script every X minutes to chown the files to root and remove write permission from everyone else? I haven't tested that (or the command below) but something like:

find '/mnt/RecycleBin/User Shares' -type f -follow -exec chown root:root {} \; -exec chmod ag-w {} \;

Or use inotify if you want to get fancy.

Edited by CS01-HS
pre-coffee
Link to comment
On 12/28/2020 at 8:55 AM, CS01-HS said:

Couldn't you run a user script every X minutes to chown the files to root and remove write permission from everyone else? I haven't tested that (or the command below) but something like:


find '/mnt/RecycleBin/User Shares' -type f -follow -exec chown root:root {} \; -exec chmod ag-w {} \;

Or use inotify if you want to get fancy.

That sounds like it could work, but sounds fiddly to what Im thinking where Ill have a vm with a share.... to a folder in the share.

 

This way the deleted files just wont be there for the end user (me) or I can set it up as read only, and wont have to rely on  a script.

 

The worry with that script is Im not sure how the permissions work or if that would break through unraid changing.

Link to comment

I've just made a new Unraid Server, fresh install and I noticed this error during install of recycle bin plug in. Any help on resolving this issue would be greatly appreciated.

root: Warning: file_put_contents(/boot/config/plugins/recycle.bin/config/smb-extra.conf): failed to open stream: No such file or directory in Standard input code on line 7

 

Link to comment
  • 2 weeks later...

Hello,

 

I have walked through a little thread regarding accessing the recycle bin!

 

It would be good to offer an option that automatically makes the trash folder and its contents completely inaccessible to the logged in user. Why ? For security purposes !

 

Imagine that the user is the victim of a virus or ransonware, the files in the recycle bin could save hours of work ^^ This is why the configuration of the recycle bin must be able to be configured (a bit like on Synology's DSM in short)

Link to comment

Hello, I have been using this plugin for some time but it seems I have run into a massive issue. Emptying the recycle big deleted the files, but somehow my disk space is not recovered. In Krusader and QDirStat the files are gone but for some reason unraid has not given me my disk space back at all yet and I need some help figuring this out. if I cant get this disk space back then I will have to wipe my cache drive and start over from a backup which is unacceptably terrible of a thought. Any idea why this is happening? I just tested it with 6GB of files and now that space is totally gone and not usable. any idea where I can start?

 

UPDATE: Sorry, please disregard. No only was I mistaken about this plugin not working anymore, I ALSO was able to track down where my extra space was going and it was 100% totally unrelated. There were just multiple coincidences right in a row that made it impossible for me to know any different and led me to an inaccurate assumption. Thanks for the plugin, I love it and will continue to use it regularly! 👍

Edited by cammelspit
Update
Link to comment
  • 4 weeks later...

I have installed this plugin but it does not add a .recycle bin to any of my Unraid shares.  It only adds it to my Unassigned drive share (Which I also want).  Is there something I need to configure?  See screenshot below on how my "files share" (Which is on the array) does not get a .recycle.bin when my "NVME" share (Which is on an unassigned drive) does.  Ive also tested deleting a file from the array and it does not appear goto this recycle bin plugin.

 

Capture.PNG

Edited by 007craft
Link to comment
7 hours ago, 007craft said:

I have installed this plugin but it does not add a .recycle bin to any of my Unraid shares.  It only adds it to my Unassigned drive share (Which I also want).  Is there something I need to configure?  See screenshot below on how my "files share" (Which is on the array) does not get a .recycle.bin when my "NVME" share (Which is on an unassigned drive) does.  Ive also tested deleting a file from the array and it does not appear goto this recycle bin plugin.

 

Capture.PNG

The recycle bin is only for SMB shares.  You are deleting the files through a SMB share?

Link to comment
8 hours ago, dlandon said:

The recycle bin is only for SMB shares.  You are deleting the files through a SMB share?

I'm deleting files from my windows machine.  So yes SMB share.  In this particular case its the "files" smb share.  Located at \\unraid\files (which is actually /mnt/user/files on the unraod machine.

 

Here's a picture of the smb extra settings if it helps.  Im not sure if this plugin has an intent to add anything extra to it?

Screenshot_20210210-101622_Firefox.jpg

Edited by 007craft
Link to comment
On 1/2/2021 at 5:12 AM, odje said:

I've just made a new Unraid Server, fresh install and I noticed this error during install of recycle bin plug in. Any help on resolving this issue would be greatly appreciated.

 

After trying to troubleshoot my Issue with recycle bin not working on non unassigned drives I reinstalled the plkugin but this time payed attention to the process.  I get this exact same error.  Looks like the plugin is failing to update the contents of the sbm-extra.conf file, thus it wont work with any unraid Samba shares.  So looks like the plugin is currently broken.  Can somebody advise a fix?

If I turn on file deletion logging, that will even detect files being deleted from share, yet still no share or recycle object shows up (see screenshot)

 

Capture.thumb.PNG.d4eb29cffabdd35e2178baabf708fd58.PNG

Quote


root: Warning: file_put_contents(/boot/config/plugins/recycle.bin/config/smb-extra.conf): failed to open stream: No such file or directory in Standard input code on line 7

 

 

Edited by 007craft
Link to comment
4 hours ago, 007craft said:

Here's a picture of the smb extra settings if it helps.  Im not sure if this plugin has an intent to add anything extra to it?

It looks like you have manually changed some things in the smb extra file.  Yes, the recycle bin makes some changes to the smb extra file.  Please remove the lines from [rootshare] on, then remove and re-install the recycle bin plugin.

 

The line 'vfs objects=' is probably removing the vfs recycle bin.

 

Link to comment
3 hours ago, 007craft said:

 

After trying to troubleshoot my Issue with recycle bin not working on non unassigned drives I reinstalled the plkugin but this time payed attention to the process.  I get this exact same error.  Looks like the plugin is failing to update the contents of the sbm-extra.conf file, thus it wont work with any unraid Samba shares.  So looks like the plugin is currently broken.  Can somebody advise a fix?

If I turn on file deletion logging, that will even detect files being deleted from share, yet still no share or recycle object shows up (see screenshot)

 

Capture.thumb.PNG.d4eb29cffabdd35e2178baabf708fd58.PNG

 

I've updated the plugin.  Stop the recycle bin, update the plugin, then re-start the recycle bin.

Link to comment
4 hours ago, 007craft said:

I'm deleting files from my windows machine.  So yes SMB share.  In this particular case its the "files" smb share.  Located at \\unraid\files (which is actually /mnt/user/files on the unraod machine.

 

Here's a picture of the smb extra settings if it helps.  Im not sure if this plugin has an intent to add anything extra to it?

Screenshot_20210210-101622_Firefox.jpg

I've updated the plugin.  Stop the recycle bin, update the plugin, then re-start the recycle bin.

Link to comment
32 minutes ago, dlandon said:

The recycle bin has the same permissions as the share.  Set your user permissions on the share.

 

For security reasons, it might be good to have the possibility to set the access authorization to the recycle bin to a single user (who will be considered as administrator (root for example) of the recycle bin) with which we will not connect by sharing. This would act as a safeguard in the event of compromised security (ransonware for example)

 

You can also think about not storing the recycle bin in the share but in a place not accessible to the share !

Link to comment
45 minutes ago, NY152 said:

 

For security reasons, it might be good to have the possibility to set the access authorization to the recycle bin to a single user (who will be considered as administrator (root for example) of the recycle bin) with which we will not connect by sharing. This would act as a safeguard in the event of compromised security (ransonware for example)

 

You can also think about not storing the recycle bin in the share but in a place not accessible to the share !

I fail to understand your argument about ransomware.  How is the recycle bin at any more risk than the share?

 

The recycle bin is part of samba and I don't have a lot of control over it's operation.  The .Recycle.Bin folder is in the share.  Moving it somewhere else does not make a lot of sense.

Edited by dlandon
Link to comment

Thanks I reinstalled the plugin with the new updated version and now my SMB extras file is populated with:

#vfs_recycle_start
#Recycle bin configuration
[global]
   syslog only = No
   syslog = 0
   logging = 0
   log level = 0 vfs:0
#vfs_recycle_end

 

I also went ahead and removed the "vfs objects=" line.

It seems to be working now.  Thanks!  I guess the only thing I noticed not working is if I make a new file, and delete it right away, it doesnt show up in the recycle bin.  I'm assuming thats because when I make a new file its actually making it on cache and files on cache wouldnt goto the bin.  So the plugin works, as long as the file has had its chance to be moved over by mover.

Link to comment
8 hours ago, dlandon said:

I fail to understand your argument about ransomware.  How is the recycle bin at any more risk than the share?

 

The recycle bin is part of samba and I don't have a lot of control over it's operation.  The .Recycle.Bin folder is in the share.  Moving it somewhere else does not make a lot of sense.

 

The argument regarding ransomware (this was still an example) is that if a ransonware attacks file encryption, the source of its files (the original therefore) is deleted in favor of the encrypted version, the recycle bin could be a rampart in the sense that we would recover the original!

 

So limiting access to a defined user would make sense.

 

Placing them elsewhere would perhaps be more logical if we listen to you (Samba rights) although I doubt it because, for example, on a Synology NAS, the recycle bin can be limited to only the administrators of the machine so the thing is quite possible no ?

Link to comment

Update Edit:

 

Weird. Other files deleted in same dir show up immediately via refresh so I guess that's working but still the weird name on one.

 

Feb 13 16:37:29 unlink => .com.bombich.ccchelper.casetest Feb 13 16:37:29 unlink => .com.bombich.ccc.casetest Feb 13 16:53:05 unlink => Delete me temporary stuff/.smbdeleteAAA97f511e7007fb430 Feb 13 17:01:54 unlink => Delete me temporary stuff/Print Coupons and Earn Points & Cash Back _ MyPoints.pdf Feb 13 17:02:20 unlink => Delete me temporary stuff/netflix choosing.mov Feb 13 17:02:36 unlink => Delete me temporary stuff/sleep.mov

 

The file in bold was a .exe driver file I downloaded from somewhere, nothing strange except it was a longish filename but looked normal in Mac OS X Finder.

 

Top two files from a backup operation...they were in a different share set up with case sensitivity etc. for OS X backups. I presume that share doesn't show because they are dot files or zero length files? (that share is called 'CCC Backups'.)

 

image.thumb.png.bd9fb76889e8cfeb959ea82c96a6df09.png

-----------

 

Fresh install. 

 

Will the name of this file change in the log/change the filename later?

 

Feb 13 16:53:05 unlink => Delete me temporary stuff/.smbdeleteAAA97f511e7007fb430

 

Took a while from the time of deletion to time of it showing in the log/being browseable. Few minutes at least.

 

Also only one share showing in SMB list...is this because nothing has been deleted from those shares I presume?

 

image.thumb.png.61c881739d6bdfcb2c494dac91ea7ede.png

Edited by RealActorRob
Link to comment

New release of Recycle Bin:

- Added a permissions setting to set the permissions on the .Recycle.Bin directories.  This sets the directory permissions when files are deleted.  If you change the permissions setting, all existing directories in the .Recycle.Bin are updated to the new permissions.

- Added a confirm check box to enable destructive buttons to help with accidental clicking of empty trash buttons.

Link to comment
  • 3 weeks later...
7 minutes ago, jonasled said:

Hi, I've updated my unraid today to 6.9.0 and it looks like there is a problem with the recycle bin plugin. When the plugin ist installed on boot, the webui of unraid will not start and if you install it after boot, it will get very slow.

I'm not seeing this.  Post diagnostics.

Link to comment
  • dlandon changed the title to Recycle Bin (vfs recycle) for SMB Shares

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.