[Samba] Fruit & uchg

Andrew Walker walker.aj325 at gmail.com
Wed Apr 28 10:34:00 UTC 2021

On Wed, Apr 28, 2021 at 5:23 AM Perttu Aaltonen <perttu.aaltonen at mac.com>

> On 27. Apr 2021, at 21.59, Andrew Walker <walker.aj325 at gmail.com> wrote:
> On Tue, Apr 27, 2021 at 8:19 AM Perttu Aaltonen via samba <
> samba at lists.samba.org> wrote:
>> Hello Ralph & others knowledgeable in vfs_fruit and Netatalk.
>> How does Samba and Netatalk store the “uchg” user immutable file flag set
>> in macOS? Is it stored in an extended attribute? The behaviour I’m seeing
>> is that setting this flag from either AFP or SMB side isn’t reflected on
>> the other side. Is there a way to change this behaviour?
>> Thanks,
>> Perttu
>> --
>> To unsubscribe from this list go to the following URL and read the
>> instructions:  https://lists.samba.org/mailman/options/samba
> Ralph can correct me if I'm wrong, but I believe the MacOS SMB client
> converts schg to the DOS readonly attribute. How this is applied to the
> samba server depends on samba's configuration. The default is to write it
> inside the user.DOSATTRIB xattr for the file. In the case of FreeNAS we
> convert DOS readonly to FreeBSD's urdonly file flag. In this case readonly
> is enforced by kernel / filesystem, but behavior differs from schg.  I
> presume when you write to do the same to a MacOS SMB server it sets uchg on
> the other side?
> Hi Andrew. I can see user.DOSATTRIB on the server (Ubuntu + Samba + ZFS),
> but its content doesn’t change when I set uchg flag from the Mac client
> side and look at it with the getfattr command. So I’m not sure exactly how
> the server stores it. In any case it isn’t compatible with Netatalk since
> the flags don’t carry over, although I should have all the correct
> vfs_fruit settings for Netatalk compatibility.
> -Perttu

ZoL doesn't expose some of the nice ZFS features like these DOS modes (at
least yet). I see MacOS setting DOS readonly in pcaps on my samba server.
Remember that Apple has to also make these bits such that Windows clients
can set / remove them, and so the options for how such things can be
implemented are limited. Looking at pcap from a MacOS server, I see the
same behavior (setting DOS RO), but MacOS appears to map readonly to uchg.

Perhaps there's benefit to having vfs_fruit set "locked" in the AFP info
xattr before moving on to setting DOS readonly in the next vfs module. I
don't really like the idea of setting/unsetting uchg though. That feels
like it would be less than ideal for the poor soul who would have to
administer the server.

More information about the samba mailing list