• Mount permissions weired

    From Hans@21:1/5 to All on Fri Jul 11 19:10:01 2025
    This is a multi-part message in MIME format.

    Dear list,

    I am struggeling with a strange behavior when automounting my inbuilt harddrives.

    I have 3 harddrives, which are mounted to

    /space (sdc1) ext4
    /daten1 (sdd1) ext4
    /daten2 (sde1) ext4

    So all are the same, and the mountpoints shall all have
    ownership user:group = root:backup

    However, the latest harddrive I added, wbhich is sde1 shows wrong ownerhips, please see:

    drwxrwx--- 22 root backup 4096 11. Jul 10:18 daten1
    drwxr-xr-x 3 root root 4096 11. Jul 16:30 daten2drwxrwx--- 12 root backup 4096 25. Jun
    21:37 space

    But when I unmount sde1 it looks like this:

    drwxrwx--- 2 root backup 4096 11. Jul 16:13 daten2

    which is correct.

    My fstab looks so:

    UUID=1f............. /daten1 ext4 defaults 0 0 UUID=54.............. /daten2 ext4 defaults 0 0 UUID=80.............. /space ext4 defaults 0 0

    What can bbe wrong? What did I miss? Anything else I should check?

    I am wondering, why only the new harddrive is the problem.

    Thanks for any hints.

    Best regards

    Hans



    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    </head>
    <body><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Dear list, </p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">I am struggeling with a strange behavior when automounting my inbuilt harddrives. </p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">I have 3 harddrives, which are mounted to </p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">/space&nbsp; &nbsp;&nbsp;&nbsp; (sdc1) &nbsp;&nbsp;&nbsp; ext4 &nbsp;&nbsp;&nbsp; </p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">/daten1&nbsp;&nbsp;&nbsp; (sdd1)&nbsp;&nbsp;&nbsp; ext4</p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">/daten2&nbsp;&nbsp;&nbsp; (sde1) &nbsp;&nbsp;&nbsp; ext4</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">So all are the same, and the mountpoints shall all have </p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">ownership user:group = root:backup</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">However, the latest harddrive I added, wbhich is sde1 shows wrong ownerhips, please see:</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><span style="font-family:monospace;"><span style="color:#000000;"><span style="background-color:#ffffff;">drwxrwx---  22 root backup  4096 11. Jul 10:18 daten1 </span></span><
    br />drwxr-xr-x   3 root root    4096 11. Jul 16:30 daten2<span style="color:#000000;"><span style="background-color:#ffffff;">drwxrwx---  12 root backup  4096 25. Jun 21:37 space</span></span><br /></p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">But when I unmount sde1 it looks like this: </span></p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><span style="color:#000000;"><span style="background-color:#ffffff;">drwxrwx---   2 root backup  4096 11. Jul 16:13 daten2</span></span><br /></p>
    <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><span style="font-family:Noto Sans;">which is correct.</span></p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">My fstab looks so:</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><span style="font-family:monospace;"><span style="color:#000000;"><span style="background-color:#ffffff;">UUID=1f.............       /daten1           ext4    
    defaults        0      0 </span></span>&nbsp;<br />UUID=54..............      /daten2           ext4    defaults        0      0<br />UUID=80..............      /space           ext4    defaults
           0      0 </p>
    <p>&nbsp;<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">What can bbe wrong? What did I miss? Anything else I should check? </span></p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">I am wondering, why only the new harddrive is the problem.</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Thanks for any hints.</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Best regards</p>
    <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Hans</p>
    <br /><br /></body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Stone@21:1/5 to Hans on Fri Jul 11 19:20:01 2025
    On Fri, Jul 11, 2025 at 07:06:19PM +0200, Hans wrote:
    So all are the same, and the mountpoints shall all have

    ownership user:group = root:backup


    However, the latest harddrive I added, wbhich is sde1 shows wrong ownerhips,

    The ownership of the underlying mount point is ignored (and should
    generally be set to root:root mode 755 to avoid possible complications
    in odd cases). You need to chown the directory *after* it is mounted.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans@21:1/5 to All on Fri Jul 11 19:30:02 2025
    The ownership of the underlying mount point is ignored (and should
    generally be set to root:root mode 755 to avoid possible complications
    in odd cases). You need to chown the directory *after* it is mounted.


    This is not, what I wanted. The questions are:

    1. Why does this happen only with one of the 3 drives?

    2. What did I do wrong with this drive?

    All 3 are ext4 formatted.
    All 3 are seperate hardware.

    Best

    Hans

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Stone@21:1/5 to Hans on Fri Jul 11 20:00:01 2025
    On Fri, Jul 11, 2025 at 07:29:15PM +0200, Hans wrote:
    This is not, what I wanted. The questions are:

    1. Why does this happen only with one of the 3 drives?

    You probably set the permissions on the other two drives after they were mounted.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Smith@21:1/5 to Hans on Fri Jul 11 19:40:01 2025
    Hi,

    On Fri, Jul 11, 2025 at 07:29:15PM +0200, Hans wrote:
    The ownership of the underlying mount point is ignored (and should generally be set to root:root mode 755 to avoid possible complications
    in odd cases). You need to chown the directory *after* it is mounted.

    This is not, what I wanted.

    Why wasn't it what you "wanted"? It answers your questions.

    The questions are:

    1. Why does this happen only with one of the 3 drives?

    Because you are probably confused and did something different with the
    one that is different.

    A mount point is just a directory that has its own permissions, then you
    mount something on it and it has the permissions of whatever you
    mounted. So there are two sets of permissions to consider for each one:
    before mounting and after.

    2. What did I do wrong with this drive?

    You have simply probably forgotten to set them in one case (or did set
    them in one case, but not in the other two).

    All 3 are ext4 formatted.
    All 3 are seperate hardware.

    It doesn't matter. What you are seeing is completely normal if we assume
    you did not set the permissions how you wanted both before and after
    mounting.

    Thanks,
    Andy

    --
    https://bitfolk.com/ -- No-nonsense VPS hosting

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans@21:1/5 to All on Fri Jul 11 20:10:01 2025
    Why wasn't it what you "wanted"? It answers your questions.

    What I want is, starting the machine and want all 3 drives automatically been mounted with the same rights (here: like /daten1 and /space)

    I do NOT want to remount it manually at every boot.


    Because you are probably confused and did something different with the
    one that is different.

    Yes, agreed, but WHAT?

    A mount point is just a directory that has its own permissions, then you mount something on it and it has the permissions of whatever you
    mounted. So there are two sets of permissions to consider for each one: before mounting and after.

    Where are the permission be set at the drive? It is just a hardware without
    any folders or files on. Freshly formatted. What can be done wrong at this?


    You have simply probably forgotten to set them in one case (or did set
    them in one case, but not in the other two).
    Yes, what might it be?


    All 3 are ext4 formatted.
    All 3 are seperate hardware.

    It doesn't matter. What you are seeing is completely normal if we assume
    you did not set the permissions how you wanted both before and after mounting.

    Thanks,
    Andy

    Hans

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Stone@21:1/5 to Hans on Fri Jul 11 20:20:01 2025
    On Fri, Jul 11, 2025 at 08:02:48PM +0200, Hans wrote:
    Why wasn't it what you "wanted"? It answers your questions.

    What I want is, starting the machine and want all 3 drives automatically been >mounted with the same rights (here: like /daten1 and /space)

    Do what you were told is the proper procedure, set the permissions after
    the drive is mounted.

    I do NOT want to remount it manually at every boot.

    That has nothing to do with the permissions.

    A mount point is just a directory that has its own permissions, then you
    mount something on it and it has the permissions of whatever you
    mounted. So there are two sets of permissions to consider for each one:
    before mounting and after.

    Where are the permission be set at the drive? It is just a hardware without >any folders or files on. Freshly formatted. What can be done wrong at this?

    You have to chown/chmod the mount point *after* the drive is mounted. If
    you do it before the drive is mounted it won't have any effect on the
    mounted drive. (As you can see.) I really am not sure what else to say,
    this is how it works.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dan Purgert@21:1/5 to Hans on Fri Jul 11 20:20:01 2025
    On Jul 11, 2025, Hans wrote:
    Dear list,

    I am struggeling with a strange behavior when automounting my inbuilt harddrives.

    I have 3 harddrives, which are mounted to

    /space (sdc1) ext4
    /daten1 (sdd1) ext4
    /daten2 (sde1) ext4

    So all are the same, and the mountpoints shall all have
    ownership user:group = root:backup

    However, the latest harddrive I added, wbhich is sde1 shows wrong ownerhips, please see:

    drwxrwx--- 22 root backup 4096 11. Jul 10:18 daten1
    drwxr-xr-x 3 root root 4096 11. Jul 16:30 daten2
    drwxrwx--- 12 root backup 4096 25. Jun 21:37 space

    Ok, so you've not yet set ownership or permissions on the filesystem
    mounted at 'daten2'



    But when I unmount sde1 it looks like this:

    drwxrwx--- 2 root backup 4096 11. Jul 16:13 daten2

    You set permissions on that empty directory when nothing was mounted.
    Then you mounted a new filesystem (/dev/sde1) with the default ownership
    and permissions (root:root & rwxr-xr-x)

    What can bbe wrong? What did I miss? Anything else I should check?

    Nothing is really "wrong", you simply haven't set permissions on the new filesystem yet.

    Fix should be as easy as these three commands:

    1. (sudo) mount /dev/sde1 /daten2
    2. (sudo) chown root:backup /daten2
    3. (sudo) chmod 770 /daten2

    (skip mounting if it's already mounted)

    --
    |_|O|_|
    |_|_|O| Github: https://github.com/dpurgert
    |O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1 E067 6D65 70E5 4CE7 2860

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEE3asj+xn6fYUcweBnbWVw5UznKGAFAmhxVXsACgkQbWVw5Uzn KGBOZRAAiRaQ0NQ3+nryU1JgQL0PTWXzo7FBar8JSm0vhdYg4rIb/n9AQaJcFV8e eu+v5fDFI7DVKEgDmFnf77ajyFTRAUkJ6Q6ewX93LRfMO3YPJE5+adx9uSKHp9rS Piv+cMn1xbyRYci7imNMkHEVDrUhCftSj3URtKnF8018i5ldBGw9eJdWUFylykba VYB3ADeLJ/fq1tSkH5LPpLQyn5ZoTa1c7E/pSfvwWw7YC7oZh9Ik+taUaue9QGcV MS+zsZH1qWBR24v+nxwn1h4emebVlzZhCObQdoZRnXU/I9VWC9uESNMpb+1EvkmR PCkrmdVWeCmlB+jVn4WpvFfaycVpEFqQhuUMTJ+XX+KbQMdmP2pQjLEh91TfW11x g+8xKR2PVzBvXgtWlzlqJonX6+d2hhCvCNkyxKyQ7yvS8E9tiX28qLHrlce3AVL7 Baw/OUJnejA9b2VNR9WnVXQv+80b1Ov+MibzydNY/Gr+yulXzxnaz51yEfqa2mol wpNt6fI+njNYJn0bXx81BVtS/wrV6pLtlGW4/x8sCseyuMUe9uWxiVYN6ZumrZ4y ab4Ltap4rJdvJ7Q+w/0IWeuvHmXXsTClG53UJ2fU2jTEV9lHiRErxZbc1DIBwt1z jfAZeDXjpWga4vfFehdmFIB/Wuxa2yCu9XO6LrssLiq/ZP32kWo=
    =JSoA
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Us
  • From Detlef Vollmann@21:1/5 to Hans on Fri Jul 11 20:30:02 2025
    On 7/11/25 20:02, Hans wrote:
    Where are the permission be set at the drive? It is just a hardware without any folders or files on. Freshly formatted. What can be done wrong at this?

    Nothing is wrong. After a fresh format (mke2fs) the root directory
    belongs to root:root, and that is what you see as soon as you mont
    the filesystem.

    If you now do a 'chown root:backup /daten2', after a reboot you will
    see that everything is as you expect...

    Detlef

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans@21:1/5 to All on Fri Jul 11 20:30:02 2025
    You have to chown/chmod the mount point *after* the drive is mounted. If
    you do it before the drive is mounted it won't have any effect on the
    mounted drive. (As you can see.) I really am not sure what else to say,
    this is how it works.

    Ok, I did as adviced. Changed permissions and ownerships after mount, then rebooted and it loks like it worked.

    Just for understanding: What does this procedure affect? Does ist set the ownerships to this device or does it somehow let the kernel remember or is
    this owneship stored somewher else?

    Hans

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Stone@21:1/5 to Hans on Fri Jul 11 20:40:01 2025
    On Fri, Jul 11, 2025 at 08:19:47PM +0200, Hans wrote:
    Just for understanding: What does this procedure affect? Does ist set the >ownerships to this device or does it somehow let the kernel remember or is >this owneship stored somewher else?

    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dan Ritter@21:1/5 to Hans on Fri Jul 11 20:50:01 2025
    Hans wrote:
    You have to chown/chmod the mount point *after* the drive is mounted. If you do it before the drive is mounted it won't have any effect on the mounted drive. (As you can see.) I really am not sure what else to say, this is how it works.

    Ok, I did as adviced. Changed permissions and ownerships after mount, then rebooted and it loks like it worked.

    Just for understanding: What does this procedure affect? Does ist set the ownerships to this device or does it somehow let the kernel remember or is this owneship stored somewher else?

    Owners, groups and permissions are stored as numbers on each
    filesystem.

    Translation of numbers to names for owners and groups is done by
    the running kernel by consulting /etc/passwd and /etc/group, or
    on some systems other directories like LDAP.

    -dsr-

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans@21:1/5 to All on Fri Jul 11 20:50:01 2025
    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.

    My mistake, sorry. But more important: Lesson learnt!

    So, thank you all very much. This issue can safely be closed.

    Best regards

    Hans

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dan Ritter@21:1/5 to David on Sat Jul 12 05:30:01 2025
    David wrote:
    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.

    It is not relevant to Linux of any distribution that I am aware
    of. The AIX source code descends from AT&T System V Release 4.3,
    and has been in IBM's hands every since. Linux was written from
    scratch almost five years later.

    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

    I don't know any reason not to do that, in those circumstances.

    -dsr-

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Stone@21:1/5 to David on Sat Jul 12 17:40:01 2025
    On Sat, Jul 12, 2025 at 02:51:25AM +0000, David wrote:
    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.

    Well, for some reason you linked to AIX documentation, and while this
    isn't an issue on linux, it definitely has been an issue on other OSs
    and is a bad habit to get into if someone wants to use more than just
    linux. I have seen people be burned by this when using linux habits on
    other systems. It's a real mess because it can't be fixed on an active
    system. (You can't change the permissions on the underlying directory
    without unmounting the overlying filesystem.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)