Filesystem mounted as root but owned by user. Why?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
8
down vote

favorite












I'm mounting a filesystem as root and I don't understand why it is not owned by root but by an unprivileged user.



Here's fstab:



cat /etc/fstab
[...]
/dev/sdb /mnt/projects ext4 defaults 0 2


And here's what happens when mounting:



ls -al /mnt/projects/ 
total 8
drwxr-xr-x 2 root root 4096 mai 25 17:55 .
drwxr-xr-x 3 root root 4096 mai 25 17:55 ..

mount /dev/sdb

ls -al /mnt/projects/
total 24
drwx------ 3 jerome jerome 4096 mai 25 17:52 .
drwxr-xr-x 3 root root 4096 mai 25 17:55 ..
drwx------ 2 root root 16384 mai 25 17:52 lost+found


I'm not using sudo. I switch to root user with the su command.



The user that gains ownership is my normal user, the first declared when installing the system (uid: 1000).



The mount point is owned by root. I don't think that matters anyway.



My normal user doesn't have the permissions to mount the filesystem here himself.







share|improve this question























    up vote
    8
    down vote

    favorite












    I'm mounting a filesystem as root and I don't understand why it is not owned by root but by an unprivileged user.



    Here's fstab:



    cat /etc/fstab
    [...]
    /dev/sdb /mnt/projects ext4 defaults 0 2


    And here's what happens when mounting:



    ls -al /mnt/projects/ 
    total 8
    drwxr-xr-x 2 root root 4096 mai 25 17:55 .
    drwxr-xr-x 3 root root 4096 mai 25 17:55 ..

    mount /dev/sdb

    ls -al /mnt/projects/
    total 24
    drwx------ 3 jerome jerome 4096 mai 25 17:52 .
    drwxr-xr-x 3 root root 4096 mai 25 17:55 ..
    drwx------ 2 root root 16384 mai 25 17:52 lost+found


    I'm not using sudo. I switch to root user with the su command.



    The user that gains ownership is my normal user, the first declared when installing the system (uid: 1000).



    The mount point is owned by root. I don't think that matters anyway.



    My normal user doesn't have the permissions to mount the filesystem here himself.







    share|improve this question





















      up vote
      8
      down vote

      favorite









      up vote
      8
      down vote

      favorite











      I'm mounting a filesystem as root and I don't understand why it is not owned by root but by an unprivileged user.



      Here's fstab:



      cat /etc/fstab
      [...]
      /dev/sdb /mnt/projects ext4 defaults 0 2


      And here's what happens when mounting:



      ls -al /mnt/projects/ 
      total 8
      drwxr-xr-x 2 root root 4096 mai 25 17:55 .
      drwxr-xr-x 3 root root 4096 mai 25 17:55 ..

      mount /dev/sdb

      ls -al /mnt/projects/
      total 24
      drwx------ 3 jerome jerome 4096 mai 25 17:52 .
      drwxr-xr-x 3 root root 4096 mai 25 17:55 ..
      drwx------ 2 root root 16384 mai 25 17:52 lost+found


      I'm not using sudo. I switch to root user with the su command.



      The user that gains ownership is my normal user, the first declared when installing the system (uid: 1000).



      The mount point is owned by root. I don't think that matters anyway.



      My normal user doesn't have the permissions to mount the filesystem here himself.







      share|improve this question











      I'm mounting a filesystem as root and I don't understand why it is not owned by root but by an unprivileged user.



      Here's fstab:



      cat /etc/fstab
      [...]
      /dev/sdb /mnt/projects ext4 defaults 0 2


      And here's what happens when mounting:



      ls -al /mnt/projects/ 
      total 8
      drwxr-xr-x 2 root root 4096 mai 25 17:55 .
      drwxr-xr-x 3 root root 4096 mai 25 17:55 ..

      mount /dev/sdb

      ls -al /mnt/projects/
      total 24
      drwx------ 3 jerome jerome 4096 mai 25 17:52 .
      drwxr-xr-x 3 root root 4096 mai 25 17:55 ..
      drwx------ 2 root root 16384 mai 25 17:52 lost+found


      I'm not using sudo. I switch to root user with the su command.



      The user that gains ownership is my normal user, the first declared when installing the system (uid: 1000).



      The mount point is owned by root. I don't think that matters anyway.



      My normal user doesn't have the permissions to mount the filesystem here himself.









      share|improve this question










      share|improve this question




      share|improve this question









      asked May 28 at 7:31









      Jérôme

      7812728




      7812728




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          22
          down vote



          accepted










          This means that the file system being mounted contains a root directory owned by user 1000 and group 1000. The ownership of a mounted file system’s root directory becomes the ownership of the mount point.






          share|improve this answer

















          • 1




            I suppose this is because I created the partition using gnome-disks as unprivileged user. But there is nothing in that GUI informing me about it.
            – Jérôme
            May 28 at 8:22






          • 3




            @Jérôme The owner of the root of a file system can be changed with chown just like any other directory.
            – kasperd
            May 28 at 10:21










          • OK @kasperd. I was just surprised it was jerome and not root in the first place since I thought I did everything as root.
            – Jérôme
            May 28 at 10:29










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446423%2ffilesystem-mounted-as-root-but-owned-by-user-why%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          22
          down vote



          accepted










          This means that the file system being mounted contains a root directory owned by user 1000 and group 1000. The ownership of a mounted file system’s root directory becomes the ownership of the mount point.






          share|improve this answer

















          • 1




            I suppose this is because I created the partition using gnome-disks as unprivileged user. But there is nothing in that GUI informing me about it.
            – Jérôme
            May 28 at 8:22






          • 3




            @Jérôme The owner of the root of a file system can be changed with chown just like any other directory.
            – kasperd
            May 28 at 10:21










          • OK @kasperd. I was just surprised it was jerome and not root in the first place since I thought I did everything as root.
            – Jérôme
            May 28 at 10:29














          up vote
          22
          down vote



          accepted










          This means that the file system being mounted contains a root directory owned by user 1000 and group 1000. The ownership of a mounted file system’s root directory becomes the ownership of the mount point.






          share|improve this answer

















          • 1




            I suppose this is because I created the partition using gnome-disks as unprivileged user. But there is nothing in that GUI informing me about it.
            – Jérôme
            May 28 at 8:22






          • 3




            @Jérôme The owner of the root of a file system can be changed with chown just like any other directory.
            – kasperd
            May 28 at 10:21










          • OK @kasperd. I was just surprised it was jerome and not root in the first place since I thought I did everything as root.
            – Jérôme
            May 28 at 10:29












          up vote
          22
          down vote



          accepted







          up vote
          22
          down vote



          accepted






          This means that the file system being mounted contains a root directory owned by user 1000 and group 1000. The ownership of a mounted file system’s root directory becomes the ownership of the mount point.






          share|improve this answer













          This means that the file system being mounted contains a root directory owned by user 1000 and group 1000. The ownership of a mounted file system’s root directory becomes the ownership of the mount point.







          share|improve this answer













          share|improve this answer



          share|improve this answer











          answered May 28 at 7:45









          Stephen Kitt

          140k22302363




          140k22302363







          • 1




            I suppose this is because I created the partition using gnome-disks as unprivileged user. But there is nothing in that GUI informing me about it.
            – Jérôme
            May 28 at 8:22






          • 3




            @Jérôme The owner of the root of a file system can be changed with chown just like any other directory.
            – kasperd
            May 28 at 10:21










          • OK @kasperd. I was just surprised it was jerome and not root in the first place since I thought I did everything as root.
            – Jérôme
            May 28 at 10:29












          • 1




            I suppose this is because I created the partition using gnome-disks as unprivileged user. But there is nothing in that GUI informing me about it.
            – Jérôme
            May 28 at 8:22






          • 3




            @Jérôme The owner of the root of a file system can be changed with chown just like any other directory.
            – kasperd
            May 28 at 10:21










          • OK @kasperd. I was just surprised it was jerome and not root in the first place since I thought I did everything as root.
            – Jérôme
            May 28 at 10:29







          1




          1




          I suppose this is because I created the partition using gnome-disks as unprivileged user. But there is nothing in that GUI informing me about it.
          – Jérôme
          May 28 at 8:22




          I suppose this is because I created the partition using gnome-disks as unprivileged user. But there is nothing in that GUI informing me about it.
          – Jérôme
          May 28 at 8:22




          3




          3




          @Jérôme The owner of the root of a file system can be changed with chown just like any other directory.
          – kasperd
          May 28 at 10:21




          @Jérôme The owner of the root of a file system can be changed with chown just like any other directory.
          – kasperd
          May 28 at 10:21












          OK @kasperd. I was just surprised it was jerome and not root in the first place since I thought I did everything as root.
          – Jérôme
          May 28 at 10:29




          OK @kasperd. I was just surprised it was jerome and not root in the first place since I thought I did everything as root.
          – Jérôme
          May 28 at 10:29












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446423%2ffilesystem-mounted-as-root-but-owned-by-user-why%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?