Set appropriate permissions on .recycle directory
We have a TrueNAS customer that has enabled the recycle bin functionality in Samba. They are getting hammered with error messages like similar.
[2019/01/21 12:05:46.738270, 1] ../source3/modules/vfs_recycle.c:311(recycle_create_dir) recycle: mkdir failed for .recycle/jwheat with error: Permission denied
After discussion with Andrew Walker, an idea arose to fix this by doing the following.
1. if recycle bin is enabled
2. on connect, samba will "become root" and create the user directory underneath the .recycle directory
3. after creation, samba will chown that user directory to the ad user on connect
This will get around the permissions errors related to the .recycle directory that this customer is experiencing.
#7 Updated by Andrew Walker almost 3 years ago
I fixed this in a slightly different way than mentioned in the ticket. We were getting "permission denied" because chmod() is disallowed when extended ACLs are present when the ZFS aclmode is set to restricted. I modified vfs_recycle so that it strips the inherited extended ACL from the ".recycle" directory during creation. This allows the vfs module to work as designed.