Inconsistent Mount Permissions












0















I have two SSD's with an ext4 filesystem on them. When I mount sda1 onto /mnt/old-samsung-830 it changes the owner and group of the /mnt/old-samsung-830 directory from root:root to jim:jim. However, if I umount sda1, and mount sdb1 onto the same directory, the owner and group remains as root. I cannot explain this behavior & want someone to explain why/how this is happening. Here is the example:



### **Note the two disks are unmounted** ###
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
└─sda1 8:1 0 223.6G 0 part
sdb 8:16 0 238.5G 0 disk
└─sdb1 8:17 0 238.5G 0 part

### **Note the permissions of the old-samsung-830 directory ** ###
[jim@computer mnt]$ ls -al
total 16
drwxr-xr-x 4 root root 4096 Feb 2 19:14 .
drwxr-xr-x 17 root root 4096 Feb 2 13:03 ..
drwxr-xr-x 2 root root 4096 Feb 2 19:14 old-samsung-830
drwxr-xr-x 2 root root 4096 Feb 2 18:59 storage

### **Time to mount sda1. Notice the owner and group has changed to jim** ###
[jim@computer mnt]$ sudo mount /dev/sda1 old-samsung-830
[jim@computer mnt]$ ls -al
total 16
drwxr-xr-x 4 root root 4096 Feb 2 19:14 .
drwxr-xr-x 17 root root 4096 Feb 2 13:03 ..
drwxr-xr-x 17 jim jim 4096 Feb 2 19:00 old-samsung-830
drwxr-xr-x 2 root root 4096 Feb 2 18:59 storage

### **Time to unmount this, and try the other drive in the same directory** ###
[jim@computer mnt]$ sudo umount /dev/sda1
[jim@computer mnt]$ sudo mount /dev/sdb1 old-samsung-830
[jim@computer mnt]$ ls -al
total 16
drwxr-xr-x 4 root root 4096 Feb 2 19:14 .
drwxr-xr-x 17 root root 4096 Feb 2 13:03 ..
drwxr-xr-x 3 root root 4096 Feb 2 19:16 old-samsung-830
drwxr-xr-x 2 root root 4096 Feb 2 18:59 storage
[jim@computer mnt]$


This is a very fresh Ubuntu install, and I have only got basic stuff (i.e. no fancy fstab or facl's) working on the PC. I just want someone to explain how it's possible that when sda1 is mounted, it changes the permissions of the folder to jim:jim, but then when sdb1 is mounted on the same directory, it stays as root. How is this possible?



I ultimately would love all my drives to mount and use jim:jim (just like when sda1 was mounted). But I don't understand how or why it works.










share|improve this question



























    0















    I have two SSD's with an ext4 filesystem on them. When I mount sda1 onto /mnt/old-samsung-830 it changes the owner and group of the /mnt/old-samsung-830 directory from root:root to jim:jim. However, if I umount sda1, and mount sdb1 onto the same directory, the owner and group remains as root. I cannot explain this behavior & want someone to explain why/how this is happening. Here is the example:



    ### **Note the two disks are unmounted** ###
    $ lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 0 223.6G 0 disk
    └─sda1 8:1 0 223.6G 0 part
    sdb 8:16 0 238.5G 0 disk
    └─sdb1 8:17 0 238.5G 0 part

    ### **Note the permissions of the old-samsung-830 directory ** ###
    [jim@computer mnt]$ ls -al
    total 16
    drwxr-xr-x 4 root root 4096 Feb 2 19:14 .
    drwxr-xr-x 17 root root 4096 Feb 2 13:03 ..
    drwxr-xr-x 2 root root 4096 Feb 2 19:14 old-samsung-830
    drwxr-xr-x 2 root root 4096 Feb 2 18:59 storage

    ### **Time to mount sda1. Notice the owner and group has changed to jim** ###
    [jim@computer mnt]$ sudo mount /dev/sda1 old-samsung-830
    [jim@computer mnt]$ ls -al
    total 16
    drwxr-xr-x 4 root root 4096 Feb 2 19:14 .
    drwxr-xr-x 17 root root 4096 Feb 2 13:03 ..
    drwxr-xr-x 17 jim jim 4096 Feb 2 19:00 old-samsung-830
    drwxr-xr-x 2 root root 4096 Feb 2 18:59 storage

    ### **Time to unmount this, and try the other drive in the same directory** ###
    [jim@computer mnt]$ sudo umount /dev/sda1
    [jim@computer mnt]$ sudo mount /dev/sdb1 old-samsung-830
    [jim@computer mnt]$ ls -al
    total 16
    drwxr-xr-x 4 root root 4096 Feb 2 19:14 .
    drwxr-xr-x 17 root root 4096 Feb 2 13:03 ..
    drwxr-xr-x 3 root root 4096 Feb 2 19:16 old-samsung-830
    drwxr-xr-x 2 root root 4096 Feb 2 18:59 storage
    [jim@computer mnt]$


    This is a very fresh Ubuntu install, and I have only got basic stuff (i.e. no fancy fstab or facl's) working on the PC. I just want someone to explain how it's possible that when sda1 is mounted, it changes the permissions of the folder to jim:jim, but then when sdb1 is mounted on the same directory, it stays as root. How is this possible?



    I ultimately would love all my drives to mount and use jim:jim (just like when sda1 was mounted). But I don't understand how or why it works.










    share|improve this question

























      0












      0








      0








      I have two SSD's with an ext4 filesystem on them. When I mount sda1 onto /mnt/old-samsung-830 it changes the owner and group of the /mnt/old-samsung-830 directory from root:root to jim:jim. However, if I umount sda1, and mount sdb1 onto the same directory, the owner and group remains as root. I cannot explain this behavior & want someone to explain why/how this is happening. Here is the example:



      ### **Note the two disks are unmounted** ###
      $ lsblk
      NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
      sda 8:0 0 223.6G 0 disk
      └─sda1 8:1 0 223.6G 0 part
      sdb 8:16 0 238.5G 0 disk
      └─sdb1 8:17 0 238.5G 0 part

      ### **Note the permissions of the old-samsung-830 directory ** ###
      [jim@computer mnt]$ ls -al
      total 16
      drwxr-xr-x 4 root root 4096 Feb 2 19:14 .
      drwxr-xr-x 17 root root 4096 Feb 2 13:03 ..
      drwxr-xr-x 2 root root 4096 Feb 2 19:14 old-samsung-830
      drwxr-xr-x 2 root root 4096 Feb 2 18:59 storage

      ### **Time to mount sda1. Notice the owner and group has changed to jim** ###
      [jim@computer mnt]$ sudo mount /dev/sda1 old-samsung-830
      [jim@computer mnt]$ ls -al
      total 16
      drwxr-xr-x 4 root root 4096 Feb 2 19:14 .
      drwxr-xr-x 17 root root 4096 Feb 2 13:03 ..
      drwxr-xr-x 17 jim jim 4096 Feb 2 19:00 old-samsung-830
      drwxr-xr-x 2 root root 4096 Feb 2 18:59 storage

      ### **Time to unmount this, and try the other drive in the same directory** ###
      [jim@computer mnt]$ sudo umount /dev/sda1
      [jim@computer mnt]$ sudo mount /dev/sdb1 old-samsung-830
      [jim@computer mnt]$ ls -al
      total 16
      drwxr-xr-x 4 root root 4096 Feb 2 19:14 .
      drwxr-xr-x 17 root root 4096 Feb 2 13:03 ..
      drwxr-xr-x 3 root root 4096 Feb 2 19:16 old-samsung-830
      drwxr-xr-x 2 root root 4096 Feb 2 18:59 storage
      [jim@computer mnt]$


      This is a very fresh Ubuntu install, and I have only got basic stuff (i.e. no fancy fstab or facl's) working on the PC. I just want someone to explain how it's possible that when sda1 is mounted, it changes the permissions of the folder to jim:jim, but then when sdb1 is mounted on the same directory, it stays as root. How is this possible?



      I ultimately would love all my drives to mount and use jim:jim (just like when sda1 was mounted). But I don't understand how or why it works.










      share|improve this question














      I have two SSD's with an ext4 filesystem on them. When I mount sda1 onto /mnt/old-samsung-830 it changes the owner and group of the /mnt/old-samsung-830 directory from root:root to jim:jim. However, if I umount sda1, and mount sdb1 onto the same directory, the owner and group remains as root. I cannot explain this behavior & want someone to explain why/how this is happening. Here is the example:



      ### **Note the two disks are unmounted** ###
      $ lsblk
      NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
      sda 8:0 0 223.6G 0 disk
      └─sda1 8:1 0 223.6G 0 part
      sdb 8:16 0 238.5G 0 disk
      └─sdb1 8:17 0 238.5G 0 part

      ### **Note the permissions of the old-samsung-830 directory ** ###
      [jim@computer mnt]$ ls -al
      total 16
      drwxr-xr-x 4 root root 4096 Feb 2 19:14 .
      drwxr-xr-x 17 root root 4096 Feb 2 13:03 ..
      drwxr-xr-x 2 root root 4096 Feb 2 19:14 old-samsung-830
      drwxr-xr-x 2 root root 4096 Feb 2 18:59 storage

      ### **Time to mount sda1. Notice the owner and group has changed to jim** ###
      [jim@computer mnt]$ sudo mount /dev/sda1 old-samsung-830
      [jim@computer mnt]$ ls -al
      total 16
      drwxr-xr-x 4 root root 4096 Feb 2 19:14 .
      drwxr-xr-x 17 root root 4096 Feb 2 13:03 ..
      drwxr-xr-x 17 jim jim 4096 Feb 2 19:00 old-samsung-830
      drwxr-xr-x 2 root root 4096 Feb 2 18:59 storage

      ### **Time to unmount this, and try the other drive in the same directory** ###
      [jim@computer mnt]$ sudo umount /dev/sda1
      [jim@computer mnt]$ sudo mount /dev/sdb1 old-samsung-830
      [jim@computer mnt]$ ls -al
      total 16
      drwxr-xr-x 4 root root 4096 Feb 2 19:14 .
      drwxr-xr-x 17 root root 4096 Feb 2 13:03 ..
      drwxr-xr-x 3 root root 4096 Feb 2 19:16 old-samsung-830
      drwxr-xr-x 2 root root 4096 Feb 2 18:59 storage
      [jim@computer mnt]$


      This is a very fresh Ubuntu install, and I have only got basic stuff (i.e. no fancy fstab or facl's) working on the PC. I just want someone to explain how it's possible that when sda1 is mounted, it changes the permissions of the folder to jim:jim, but then when sdb1 is mounted on the same directory, it stays as root. How is this possible?



      I ultimately would love all my drives to mount and use jim:jim (just like when sda1 was mounted). But I don't understand how or why it works.







      permissions






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 2 at 22:29









      john smithjohn smith

      1,06642041




      1,06642041






















          1 Answer
          1






          active

          oldest

          votes


















          1














          It does not change the permissions of the subdirectory.



          When you mount a filesystem onto a mountpoint, the original mountpoint becomes inaccessible and its name refers to the mounted filesystem. So, after



          sudo mount /dev/sda1 old-samsung-830


          the name ./old-samsung-830 no longer refers to your subdirectory, but to the mounted filesystem.



          In your case, it looks that one of the filesystems is owned by jim:jim and the other by root:root. That's perfectly natural. If you don't like it, you can always sudo chown -R on the mounted filesystem.



          (Pet peeve: Folders are the pretty pictures displayed in a GUI. The structures in the filesystem are directories. While most folders do indeed correspond to directories, this is not always the case; the GUI can, and does, create and manage folders which do not correspond to filesystem directories.)






          share|improve this answer
























          • Thanks. I just don't understand how a filesystem has an owner that's all. I thought permissions were assigned to directories and files, not the actual underlying ext4 filesystem.

            – john smith
            Feb 3 at 0:32











          • @johnsmith: The root directory of a filesystem is a directory like any other directory. It has an owner and file mode bits just like any other directory. When you mount a filesystem, the name of the mountpoint refers to the root directory of that filesystem, and you see the owner and mode of that directory.

            – AlexP
            Feb 3 at 0:40











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1115108%2finconsistent-mount-permissions%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          It does not change the permissions of the subdirectory.



          When you mount a filesystem onto a mountpoint, the original mountpoint becomes inaccessible and its name refers to the mounted filesystem. So, after



          sudo mount /dev/sda1 old-samsung-830


          the name ./old-samsung-830 no longer refers to your subdirectory, but to the mounted filesystem.



          In your case, it looks that one of the filesystems is owned by jim:jim and the other by root:root. That's perfectly natural. If you don't like it, you can always sudo chown -R on the mounted filesystem.



          (Pet peeve: Folders are the pretty pictures displayed in a GUI. The structures in the filesystem are directories. While most folders do indeed correspond to directories, this is not always the case; the GUI can, and does, create and manage folders which do not correspond to filesystem directories.)






          share|improve this answer
























          • Thanks. I just don't understand how a filesystem has an owner that's all. I thought permissions were assigned to directories and files, not the actual underlying ext4 filesystem.

            – john smith
            Feb 3 at 0:32











          • @johnsmith: The root directory of a filesystem is a directory like any other directory. It has an owner and file mode bits just like any other directory. When you mount a filesystem, the name of the mountpoint refers to the root directory of that filesystem, and you see the owner and mode of that directory.

            – AlexP
            Feb 3 at 0:40
















          1














          It does not change the permissions of the subdirectory.



          When you mount a filesystem onto a mountpoint, the original mountpoint becomes inaccessible and its name refers to the mounted filesystem. So, after



          sudo mount /dev/sda1 old-samsung-830


          the name ./old-samsung-830 no longer refers to your subdirectory, but to the mounted filesystem.



          In your case, it looks that one of the filesystems is owned by jim:jim and the other by root:root. That's perfectly natural. If you don't like it, you can always sudo chown -R on the mounted filesystem.



          (Pet peeve: Folders are the pretty pictures displayed in a GUI. The structures in the filesystem are directories. While most folders do indeed correspond to directories, this is not always the case; the GUI can, and does, create and manage folders which do not correspond to filesystem directories.)






          share|improve this answer
























          • Thanks. I just don't understand how a filesystem has an owner that's all. I thought permissions were assigned to directories and files, not the actual underlying ext4 filesystem.

            – john smith
            Feb 3 at 0:32











          • @johnsmith: The root directory of a filesystem is a directory like any other directory. It has an owner and file mode bits just like any other directory. When you mount a filesystem, the name of the mountpoint refers to the root directory of that filesystem, and you see the owner and mode of that directory.

            – AlexP
            Feb 3 at 0:40














          1












          1








          1







          It does not change the permissions of the subdirectory.



          When you mount a filesystem onto a mountpoint, the original mountpoint becomes inaccessible and its name refers to the mounted filesystem. So, after



          sudo mount /dev/sda1 old-samsung-830


          the name ./old-samsung-830 no longer refers to your subdirectory, but to the mounted filesystem.



          In your case, it looks that one of the filesystems is owned by jim:jim and the other by root:root. That's perfectly natural. If you don't like it, you can always sudo chown -R on the mounted filesystem.



          (Pet peeve: Folders are the pretty pictures displayed in a GUI. The structures in the filesystem are directories. While most folders do indeed correspond to directories, this is not always the case; the GUI can, and does, create and manage folders which do not correspond to filesystem directories.)






          share|improve this answer













          It does not change the permissions of the subdirectory.



          When you mount a filesystem onto a mountpoint, the original mountpoint becomes inaccessible and its name refers to the mounted filesystem. So, after



          sudo mount /dev/sda1 old-samsung-830


          the name ./old-samsung-830 no longer refers to your subdirectory, but to the mounted filesystem.



          In your case, it looks that one of the filesystems is owned by jim:jim and the other by root:root. That's perfectly natural. If you don't like it, you can always sudo chown -R on the mounted filesystem.



          (Pet peeve: Folders are the pretty pictures displayed in a GUI. The structures in the filesystem are directories. While most folders do indeed correspond to directories, this is not always the case; the GUI can, and does, create and manage folders which do not correspond to filesystem directories.)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 2 at 23:58









          AlexPAlexP

          7,74511630




          7,74511630













          • Thanks. I just don't understand how a filesystem has an owner that's all. I thought permissions were assigned to directories and files, not the actual underlying ext4 filesystem.

            – john smith
            Feb 3 at 0:32











          • @johnsmith: The root directory of a filesystem is a directory like any other directory. It has an owner and file mode bits just like any other directory. When you mount a filesystem, the name of the mountpoint refers to the root directory of that filesystem, and you see the owner and mode of that directory.

            – AlexP
            Feb 3 at 0:40



















          • Thanks. I just don't understand how a filesystem has an owner that's all. I thought permissions were assigned to directories and files, not the actual underlying ext4 filesystem.

            – john smith
            Feb 3 at 0:32











          • @johnsmith: The root directory of a filesystem is a directory like any other directory. It has an owner and file mode bits just like any other directory. When you mount a filesystem, the name of the mountpoint refers to the root directory of that filesystem, and you see the owner and mode of that directory.

            – AlexP
            Feb 3 at 0:40

















          Thanks. I just don't understand how a filesystem has an owner that's all. I thought permissions were assigned to directories and files, not the actual underlying ext4 filesystem.

          – john smith
          Feb 3 at 0:32





          Thanks. I just don't understand how a filesystem has an owner that's all. I thought permissions were assigned to directories and files, not the actual underlying ext4 filesystem.

          – john smith
          Feb 3 at 0:32













          @johnsmith: The root directory of a filesystem is a directory like any other directory. It has an owner and file mode bits just like any other directory. When you mount a filesystem, the name of the mountpoint refers to the root directory of that filesystem, and you see the owner and mode of that directory.

          – AlexP
          Feb 3 at 0:40





          @johnsmith: The root directory of a filesystem is a directory like any other directory. It has an owner and file mode bits just like any other directory. When you mount a filesystem, the name of the mountpoint refers to the root directory of that filesystem, and you see the owner and mode of that directory.

          – AlexP
          Feb 3 at 0:40


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1115108%2finconsistent-mount-permissions%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Questions related to Moebius Transform of Characteristic Function of the Primes

          List of scandals in India

          Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?