[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1D7AAEE4-9603-43A4-B89D-6F791EDCB929@live.com>
Date: Sat, 3 Dec 2022 07:56:47 +0000
From: Aditya Garg <gargaditya08@...e.com>
To: Viacheslav Dubeyko <slava@...eyko.com>
CC: "willy@...radead.org" <willy@...radead.org>,
"ira.weiny@...el.com" <ira.weiny@...el.com>,
"axboe@...nel.dk" <axboe@...nel.dk>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"bvanassche@....org" <bvanassche@....org>,
"keescook@...omium.org" <keescook@...omium.org>,
"songmuchun@...edance.com" <songmuchun@...edance.com>,
"torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] hfsplus: Fix bug causing custom uid and gid being unable
to be assigned with mount
> 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.
Powered by blists - more mailing lists