Samba recycle bin per user

sambasamba4

I am looking to solve my issue with Samba recycle bin..

I have users a1, a2, and a3, they all belong to group companya.

A samba server with the following configuration.

[global]
   workgroup = WORKGROUP
   server string = %h server (Samba, Ubuntu)
   dns proxy = no
   log file = /var/log/samba/log.%m
   max log size = 1000

# for syslog logging the following parameter to something higher.
   syslog = 0

# Do something sensible when Samba crashes: mail the admin a backtrace
   panic action = /usr/share/samba/panic-action %d

####### Authentication #######

   server role = standalone server
   passdb backend = tdbsam
   obey pam restrictions = no
   unix password sync = yes

# For Unix password sync to work on a Debian GNU/Linux system, the following
   passwd program = /usr/bin/passwd %u


[Company-A]
   comment = Company A Files
   path = /samba/share/companya
   guest ok = no
   browseable = yes
   create mask = 0775
   directory mask = 0775
   writable = yes
   valid users = +companya
   vfs object = recycle:recycle full_audit:audit
   recycle:repository = .trash/%U
   recycle:maxsize = 0
   recycle:versions = Yes
   recycle:keeptree = Yes
   recycle:touch = No
   recycle:directory_mode = 0775

My issue is that I end up with the following after user a2 deletes his first file.

Share – Trash Viewable:
Trash Viewable

Trash – Users Recycling Folder View:
Users Recycling Folder View

However when user a1 deletes a file… user a1's trash does not appear.
Has anyone come across this before?

It seems like only the person who first deletes a first deletes a file gets a recycle bin.

I need to get each user their own folder without having to manually create them.

Best Answer

It may not be a perfect solution, however I noticed that the .trash folder was created by user a2 with a primary group of NOT companya but a2 with the permissions rwxrwxr-x which means that a1 (an everybody) does not have permissions to create his trash bin label ./trash/a1.

rwxrwxr-x  a2  a2  -->  .trash/

therefore changing the share configuration to the following:

[Company-A]
   comment = Company A Files
   path = /samba/share/companya
   guest ok = no
   browseable = yes
   create mask = 0777
   directory mask = 0777
   writable = yes
   valid users = +companya
   vfs object = recycle:recycle full_audit:audit
   recycle:repository = .trash/%U
   recycle:maxsize = 0
   recycle:versions = Yes
   recycle:keeptree = Yes
   recycle:touch = No
   recycle:directory_mode = 0704

allows the .trash bin to be created with rwxrwxrwx allowing access to other users to write their trash bins retaining the ability to read others trash bins.