[Samba] Apply destination folder ACLs when moving folders

Andrew Walker walker.aj325 at gmail.com
Tue Jun 15 15:42:23 UTC 2021

On Tue, Jun 15, 2021 at 11:18 AM David PAUGAM via samba <
samba at lists.samba.org> wrote:

> Hi all,
> sorry if that question has already been asked, but I can't find any
> clear answer to this...
> I would like to move (cut and paste from a Windows station) a full
> directory with sub-directories and files from one folder in a volume to
> another folder in the same volume.
> The second folder does not have the same permissions than the first one.
> The expected behaviour is that the moved directory inherits the ACLs
> from the destination folder. But, instead, it keeps the ACLs of the
> original folder.
> Does anybody know if it is possible to force the moved folder to inherit
> the permissions from the new hierarchy?
> Thanks in advance for any help.
> David
> --
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/options/samba

This is expected behavior for this sort of operation (rename). I believe
windows has a configuration option for this "move security attributes", but
default behavior is the same as what you see in samba. I've written a VFS
module that on rename will calculate an inherited ACL from the destination,
and then use fts(3) to walk through the moved tree and re-inherits at each
level. ACL operations pass through samba's VFS so should be OS /
configuration agnostic, but fts(3) is not so much. I never upstreamed
because it won't work with vfs_glusterfs (and probably some other edge
cases), but I'm happy to make a merge request against master if there's
interest in such a capability.

More information about the samba mailing list