Can't get Recycle Bin to work

Hi,

I have a share (one per user). The user can’t write into the share, but I have a few symlinks in there that the user has permission on. (Trying to limit the drive letter mappings by mapping a single directory that has symlinks to other directories the user has rights on).

In the share, I set a vfs object of recycle, and in advanced options I have
recycle:repository = /shared/temp/recycle_bin/%U
recycle:keeptree = true
recycle:versions = true

I also tried to same thing in /etc/samba/local.conf

However, when deleting a file via Windows, a warning pops up that the delete in permanent and the recycle bin isn’t used.

Any ideas?

UCS 4.2.3 errata265

Thanks,
Gerald

Hi,

did I get it right? You have a single share which is read-only for you users. This share contains symlinks to other shares where the user has write-access?

Well, I guess for Windows it is not a different share as it does not know anything about symlinks. And the recycle bin works for drives. So Win tried to create the bin on your read-only share. Where it does not have write-access and thus cannot create the bin.
I am unsure if the mentioned options really help.

The point here is,when Windows uses the recycle bin it actually does not move the files there in, it flags them as “pending” (or so) and only touches the directory entry. It does not move the data (this would take too long). So when not touching data it cannot have recycle bin on a different physical device.

Are your shares all set to browseable=yes? I read some related post telling this helped.

But it is an interesting question, what happens when the user has write access? Does Samba then move the file? I don’t know. I would try to give write access and see if it works then.
/KNEBB

Hey,

can you please the output of the testparm command which will show the actual configuration. Thanks.

Kind regards,
mosu

Here is the dump for the test share. The Temp directory is read/write by everyone

[gbr_network]
	path = /network_share/gbr
	browseable = No
	include = /etc/samba/shares.conf.d/shamalai_network
	postexec = /root/unmount_user_dirs.sh %u
	preexec = /root/mount_user_dirs.sh %u
	inherit acls = Yes
	read only = No
	vfs objects = acl_xattr recycle
	recycle:versions = true
	recycle:keeptree = true
	recycle:repository = ./Temp/recycle_bin

Gerald

@knebb Samba lets you specify where the recycle bin should go, so I point it to a writable dir.

All my shares are non browseable though.

Gerald

Hey,

well, I’ve just tried this myself, and it seems to work just fine for me. I’ve copy-pasted your settings 1:1, and for me actually deleting the file will cause it to end up in …/Temp. Yes, Windows’ deletion dialog says otherwise, but the file is recycled instead of deleted permanently.

Note the following: the recycle bin directory and the path where files are deleted from must be on the same file system. That’s because Samba uses the rename or renameat system call for moving the files. That call only works if source and destination are on the same file system. Judging from your preexec setting, I guess that you’re mounting other file systems beneath /network_share/gbr, and that Samba cannot move the file from that other file system to /network_share/gbr/Temp/recycle_bin due to the aforementioned restriction.

Kind regards,
mosu

Darn.

I’d like to have multiple shares under a single drive letter in Windows. We use drive letters now, but they are very difficult to maintain… there’s just too many.

My initial thought was to use Windows soft links (with mklink), but that failed miserably. Every user has admin rights on their own computer, and Windows won’t let anyone with admin rights create a link unless they specifically run an elevated rights (Run as Administrator) shell. A login script runs as the user.

My main goal is that the user doesn’t delete the top level directories. Windows doesn’t see them as links, and so deletes everything underneath it as well.

Would a setfacl, removing deletion rights from the top level dirs work on a soft link?

Gerald

Mastodon