Recycle Bin (vfs recycle) for SMB Shares


dlandon

Recommended Posts

6 hours ago, trurl said:

Maybe I'm missing something, but I don't see what rm has to do with this plugin. Recycle Bin only works with files deleted over the network with SMB.

I was using rm with the 'find' command to purge aged files in the recycle bin.  I've changed it now because it seems that 'rm -rf' removes too much and removes files that haven't been aged.  I switched to using the -delete switch with 'find' which doesn't exhibit the same behavour.

 

He was just explaining how the use of 'rm -rf; with 'find' was potentially causing some problems.  I was able to duplicate the issue he was explaining.

  • Like 1
  • Thanks 1
Link to comment
13 hours ago, dlandon said:

I was using rm with the 'find' command to purge aged files in the recycle bin.  I've changed it now because it seems that 'rm -rf' removes too much and removes files that haven't been aged.  I switched to using the -delete switch with 'find' which doesn't exhibit the same behavour.

 

He was just explaining how the use of 'rm -rf; with 'find' was potentially causing some problems.  I was able to duplicate the issue he was explaining.

Thanks for explaining to trurl and for the fix - that -delete switch is a neat solution since it also enables -depth (strange word to use I thought) so files are listed before directories and therefore all (aged) empty directories are removed in one pass (in a much simpler way than I mentioned above). 

Link to comment
  • 2 weeks later...

I seem to have an issue where the deleted files log no longer works.

This issue seems to have started some time around July.

 

On two separate Unraid systems, despite the "Log Deleted Files" flag being enabled, it no longer tracks them.

When I delete a file, it correctly ends up in the recycle bin. But upon clicking "empty trash" or waiting for the automated schedule to execute, it no longer shows an 

Jul 19 02:26:13  unlink => xyz

entry.

 

This is what the recycle bin configuration looks like under smb config

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

 

Link to comment
13 hours ago, Spiritreader said:

 

On two separate Unraid systems, despite the "Log Deleted Files" flag being enabled, it no longer tracks them.

When I delete a file, it correctly ends up in the recycle bin. But upon clicking "empty trash" or waiting for the automated schedule to execute, it no longer shows an 


Jul 19 02:26:13  unlink => xyz

entry.

The log entry is only when the file is initially deleted, not when it is removed from the recycle bin.

Link to comment
On 10/1/2020 at 10:13 AM, Spiritreader said:

Oh sorry I got that confused.

Still, no log entries show up unfortunately.

 

My workflow is as follows.

 

- Delete file from SMB share

- check recycle bin, no entry

 

Deleting file from smb share

https://i.imgur.com/JGgu0Q4.png

 

Shows up in recycle bin when clicking on inspect

https://i.imgur.com/HYj8MeT.png

 

No delete log entry

https://i.imgur.com/gInWpzH.png

 

If you post diagnostics, we can help further.  I have no issues with the logging.

Link to comment
22 hours ago, dlandon said:

I think your additions to the smb-extra.conf file is causing some issues.

I have removed the extra configuration. Now it's just unassigned devices and the recycle bin.

#unassigned_devices_start
#Unassigned devices share includes
   include = /tmp/unassigned.devices/smb-settings.conf
#unassigned_devices_end
#vfs_recycle_start
#Recycle bin configuration
[global]
   syslog only = No
   syslog = 0
   logging = 0
   log level = 0 vfs:0
#vfs_recycle_end

Still no logging when deleting files unfortunately.

Link to comment
5 minutes ago, Spiritreader said:

I have removed the extra configuration. Now it's just unassigned devices and the recycle bin.


#unassigned_devices_start
#Unassigned devices share includes
   include = /tmp/unassigned.devices/smb-settings.conf
#unassigned_devices_end
#vfs_recycle_start
#Recycle bin configuration
[global]
   syslog only = No
   syslog = 0
   logging = 0
   log level = 0 vfs:0
#vfs_recycle_end

Still no logging when deleting files unfortunately.

Restart the recycle bin.

Link to comment
48 minutes ago, Spiritreader said:

I've tried the following:

- stop and restart the recycle bin

- toggle logging off and on while the recycle bin is started

- stop recycle bin, toggle logging off and on, start the recycle bin.

 

No change, still not logging.

 

image.png.2fc85a823210afb0e7984b6da1c13398.png

Go to a command prompt and enter the folowing:

cat /var/log/samba/log.smbd | grep unlink

You should see the samba log entries for deleted files.

Link to comment

Unfortunately nothing shows up.

 

I omitted the unlink to check what else samba was logging, and there's nothing there except for when the daemon is restarted due to config changes

 

root@Tower:~# cat /var/log/samba/log.smbd

[2020/10/04 21:45:16.282004,  0] ../../source3/smbd/server.c:1775(main)
  smbd version 4.11.4 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2019

 

Link to comment
1 hour ago, Spiritreader said:

Unfortunately nothing shows up.

 

I omitted the unlink to check what else samba was logging, and there's nothing there except for when the daemon is restarted due to config changes

 


root@Tower:~# cat /var/log/samba/log.smbd

[2020/10/04 21:45:16.282004,  0] ../../source3/smbd/server.c:1775(main)
  smbd version 4.11.4 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2019

 

Just released a fix.

  • Like 1
Link to comment
  • 2 weeks later...
  • 1 month later...
17 hours ago, Rendeaust said:

I've set my age days to 6 months but I still can see files in the Recycle Bin folder older than that after hitting Remove Aged Files. Does that only work on schedule (which I have turned off) or am I doing something wrong?

 

Also where can I find log deleted files? Thanks!

You aren't doing anything wrong.  The age date that the recycle bin uses is the last access time (atime in Linux) which is set when the file is deleted and sent to the .Recycle.Bin folder, not the last modified time (mtime in Linux).  If anything changes the atime of the file in the .Recycle.Bin, that will affect the age date of that file.

 

The deleted files log is found on the 'Deleted Files' tab of the Recycle Bin.  This log is derived from the '/var/log/samba/log.smbd' file.  That file is lost on reboot because it is kept in the ram file system, so you won't be able to see the deleted files after a reboot.

Link to comment
  • 1 month later...

Hi @dlandon,

 

First, thank you for this plugin, to me is a must have, just in case someone, or myself, delete somethink we don't want to.

 

Said that, and let me tell you that a I didn't read all pages of this thread, there are a few ..., there is a possibility to avoid that any user that have access to the share, delete files inside the bin? Only be able to see what inside (Read Only). An to delete the files do it from the plugin.

 

This is to avoid that someone, with no good intentions, to delete some file completely, this functionality was used by my older NAS, a synology (bye bye forever, right now I hate that type of NAS, they are so bad compared to something like Unraid...), and was pretty useful and give higher security if the intention is to protect files from shares from unauthorized users that somehow access the share.

 

Of course this is just an idea to further improve your plugin, it's ok if you see this idea a pain is the ... :P.

 

Let me know your thoughts about this.

 

Regards

Edited by iTHiNDiL
Link to comment
4 hours ago, iTHiNDiL said:

Hi @dlandon,

 

First, thank you for this plugin, to me is a must have, just in case someone, or myself, delete somethink we don't want to.

 

Said that, and let me tell you that a I didn't read all pages of this thread, there are a few ..., there is a possibility to avoid that any user that have access to the share, delete files inside the bin? Only be able to see what inside (Read Only). An to delete the files do it from the plugin.

 

This is to avoid that someone, with no good intentions, to delete some file completely, this functionality was used by my older NAS, a synology (bye bye forever, right now I hate that type of NAS, they are so bad compared to something like Unraid...), and was pretty useful and give higher security if the intention is to protect files from shares from unauthorized users that somehow access the share.

 

Of course this is just an idea to further improve your plugin, it's ok if you see this idea a pain is the ... :P.

 

Let me know your thoughts about this.

 

Regards

The Recycle Bin has the same permissions as the share they were deleted from.  If a user has read and write permissions on the share, then they have read and write permissions on the Recycle Bin.

Link to comment

I noticed on the beta thread for 6.9 that you reported that Recycle Bin was responsible for the log filling up with smbd_audit events followed by a vague post that you found the issue and resolved it.


I see my syslog filling up with these events and wonder if it's related to this plugin and specifically to the extd_audit flag that the plugin sets up?

 

Any insight you can provide as to why this might be happening? (running 6.9.0-rc2).

 

Thanks!

Edited by Gonzo-the-great
typos
Link to comment
1 hour ago, trurl said:

Settings - SMB - Hide "dot" files

Don't think this is an answer for the question:

This only will flag the recycle bin hiden, if you have "show hidden files" enabled you still be able to access the bin.

 

@NasOnABudget, right now, as dlandon said a few posts before, there is no way to accomplish this, the bin have the same permsissions as the shared folder.

Edited by iTHiNDiL
Link to comment
On 12/26/2020 at 4:01 PM, iTHiNDiL said:

Don't think this is an answer for the question:

This only will flag the recycle bin hiden, if you have "show hidden files" enabled you still be able to access the bin.

 

@NasOnABudget, right now, as dlandon said a few posts before, there is no way to accomplish this, the bin have the same permsissions as the shared folder.

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. Not having this puts a pretty big damper on unraid as a whole for me. Im wondering what can be done about it, like through a VM or something similar. I guess Ill have to start poking around in ubuntu or something.

 

I was really hoping there would be some way @dlandon might have of having the recycle bin for one share be a different share or similar.

 

(btw I only mentioned again because I edited in the name the last time so Im not sure if that still pings the user)

Edited by NasOnABudget
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.