On Fri, 11 Jul 2025 at 18:49, Hans <[email protected]> wrote: > > Permissions are stored for the root directory of each filesystem, which > > are used as the permissions of the mount point when the drive is > > mounted.
> Thanks, this is explaining all my questions. I always thought wrong, that > mounted devices and folders on it, get the ownership from the folder, it > is mounted to. Yes, this is correct, but I was not aware, when I want to > CHANGE it, I had to do it AFTER mount. Hi Hans, Your words above are unclear to me, because "I always thought wrong ... [details] ... Yes , this is correct" is ambiguous regarding whether you think the [details] are correct or incorrect. Specifically, > mounted devices and folders on it, get the ownership from the folder, it > is mounted to is incorrect. Before you jump to answer that, please read the rest of this message, which is another attempt to help you understand the situation. Try reading this: https://www.ibm.com/docs/en/aix/7.3.0?topic=mounting-mount-points Note this quote from there: " If the file or directory that serves as the mount point contains any data, that data is not accessible while it is mounted over by another file or directory. In effect, the mounted file or directory covers what was previously in that directory. " Note: Whatever is mounted over (onto a mountpoint) covers, obscures, hides, makes inaccessible, makes irrelevant, whatever might be present underneath (on that same mountpoint). The consequence of this fact is that, for any directory that is used as a mountpoint, whatever ownership and permissions were set on that directory beforehand become (as it says above) "not accessible" and so they are TOTALLY irrelevant AFTER it becomes a mount point. So anything you do to a directory before using it as a mountpoint has zero effect or consequences after it becomes a mountpoint. Any ownership and permissions that were set on the hosting mountpoint become irrelevant. Those are just part of the hosting mountpoint's data, and ALL of that data is replaced by whatever is mounted onto the mountpoint. After mounting, the mountpoint directory now presents whatever permissions were previously set on the top directory of THE MOUNTED FILESYSTEM. Any permissions previously set on the underlying directory (along with all its other data) in the hosting filesystem are not accessible. Again: when you mount something on a mountpoint, all underlying data of that mountpoint becomes hidden and inaccessible and irrelevant. In fact, if you were to do a sequence of 'mount' commands to mount different filesystems onto the same mountpoint, you would see that this is true every time you do another 'mount' onto the same mountpoint. Every time, whatever is underneath each time becomes completely inaccessible while that 'mount' is active, until a 'umount' command exposes it again. Something that I am curious to learn more about, if anyone has ideas, is the discussion at the above link about the need to have at least 'chmod 111' on mountpoint directories. I have not found that necessary, and so I wonder if that advice is outdated, or somehow not relevant to current ext4 on Debian. In fact it has been my practice for some years now to 'chown root:' and 'chmod 0' on all my mountpoints and set the immutable bit on them, to avoid accidentally writing into directories that are intended only as mountpoints. And I have never had any problem doing that, and never seen any "permission denied" messages as described in the link. And if I run 'pwd' or '/usr/bin/pwd' or 'cd ..' in such a mountpoint directory when something is mounted, 'cd' and 'pwd' works the same as any other directoy, as expected. Does anyone have any thoughts on that? Is Debian Linux somehow different to IBM AIX in that regard? (I know nothing about IBM AIX).

