Re: [PATCH] hfsplus: Fix bug causing custom uid and gid being unable to be assigned with mount

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I am slightly confused. Do you mean that all files/folders will have the same UID/GID always?

Description about this mount option is given in Documentation/filesystems/hfsplus.rst

The UIDs and GIDs of files written by macOS 13 on any HFS+ volume are 99 by default and for iPadOS 16, it is 501.
So, writing to/editing these files on Linux causes File permission errors.

The UID/GID options in mount kinda spoofs the UIDs/GIDs of all the files in a volume to the ones specified by the user.

So for example if I run "sudo mount -o uid=1000,gid=1000 /dev/sda1 /mnt”, where /dev/sda1 is my HFS+ volume, it will be mounted at /mnt and all the files and folders over there will have uid as well as gid as 1000, which is generally the username in most Linux distributions, thus making me the owner of the files.

> What if user changes the UID/GID a particular file/folder?

Note that, the above mount option is just a spoofing and actually doesn't change the permission of the files. So the files written by macOS shall still have 99 as their UID/GID and those written by iPadOS have 501.

If you want to actually change the user/group of a file/folder, use chown. The change will be persistent. Although, if partition is remounted with UID/GID options, again the driver will spoof the ownership, but the real user/group has been changed by chown, this can be proved by mounting without the UID/GID options, as described further.

> Also, what if we mounted
> file system without specifying the UID/GID, then what UID/GID will be returned by
> your logic?

So this case is if I run “sudo mount /dev/sda1 /mnt”

Here the driver will not do any spoofing, and the real owners of the files shall be displayed. Thus running “ls -l” on a mounted partition without specifying UID/GID, files written by macOS shall be shown as 99 as the owner, iPadOS as 501, and if any file was written on Linux, the user who wrote it will be the owner.

If the user/group of any file was changed using chown, then the new user/group of the file will be displayed.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux