Announcement

Collapse
No announcement yet.

Mount ext hdd as different user

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Mount ext hdd as different user

    Hello everybody,

    I hope this is the right place to post this question?

    Anyway, we have a laptop running with Kubuntu 18.04. Several people have their own account on this laptop.
    I, admin, can mount an external hdd and read/write on it. Both User and Group are set as 'administrator'. The hdd is formatted in ext4.
    However, when person X wants to work on the laptop in his own account, he can mount the hdd but only as read. Group and User are still 'administrator'.
    Now for the funny part. When I mount the hdd on my personal laptop it is mounted with my name, Group: jurgen - User: jurgen. I assume this is because I am the only user on my personal laptop?
    I tried to see what would happen with an ordinary flashdrive (fat32). The drive just mounted with the right User and Group name.

    X and the others think this to be very annoying and so do I. How can I give them the proper permissions to just mount the hdd and work as it was part of their account?

    I hope someone can enlighten me on this,
    Jurgen
    Last edited by jurgen; Mar 08, 2020, 03:15 PM.

    #2
    Either everyone has to be an 'administrator', or have individual folders on it for each account. it is a feature of ext4, and is why this is not necessarily very useful for removable drives.
    Now, if the external drive is only ever used on the one computer, you can add the drive to your fstab, then chmod the mount point to 777 to give all users read write access.
    Code:
    sudo chmod 777 /media/name-of-mount-point-folder
    But you have to deal with getting the right options in the fstab to allow for the drive not being plugged in during boot, and automounting it with all user access (I think). I cannot recall what happens with an ext4 USB drive with the automount-on-attach-for-user setup, if having it chmod'ed to 777 will work as expected in this case. But it won't hurt to check it out, before looking at faffing with the fstab and mount points and all that.

    it was such a headache for me that I went to using ntfs/fat32/exfat for my external drives that were not permanently attached and mounted, way back when I had multiple user accounts on my systems.

    Comment


      #3
      Thank you for answering me.
      So, in order to get the drive usable for all users they have to be 'admininstrator' as well. Is their an option to assign an user to 'admin'? The reason I ask is that I would like to make a backup from their account without messing up their permissions. If I backup the account within administrator all their files get this user and group name. Restoring their files means I'll have to restore the permissions as well. It would be way easier if they themselves could do the backups.
      Bother, I never realised this to be an issue with ext4. Now, I've got a drive with tons of information not writable for the users.

      Originally posted by claydoh View Post
      Either everyone has to be an 'administrator', or have individual folders on it for each account. it is a feature of ext4, and is why this is not necessarily very useful for removable drives.
      Now, if the external drive is only ever used on the one computer, you can add the drive to your fstab, then chmod the mount point to 777 to give all users read write access.
      Code:
      sudo chmod 777 /media/name-of-mount-point-folder
      But you have to deal with getting the right options in the fstab to allow for the drive not being plugged in during boot, and automounting it with all user access (I think). I cannot recall what happens with an ext4 USB drive with the automount-on-attach-for-user setup, if having it chmod'ed to 777 will work as expected in this case. But it won't hurt to check it out, before looking at faffing with the fstab and mount points and all that.

      it was such a headache for me that I went to using ntfs/fat32/exfat for my external drives that were not permanently attached and mounted, way back when I had multiple user accounts on my systems.

      Comment


        #4
        For such a narrow use-case they should be a way to make it work. So if you're using this for user backups, why not give them their own folders? You wouldn't normally want user A have access to user B files anyway. If you, as administrator, are making the backups for them, there's several ways to copy or backup another users home folder without resetting permissions and ownership.

        Please Read Me

        Comment


          #5
          Well, I just have to figure out what to do.
          Some users are working on the same files while other users are not. Separate folders maybe.
          Maybe giving the folders their own group and then assign users to that group.
          O well, never boring to play around in Linux.

          Thanks for the answers though. I never realised that ext4 had these limitations (if that is what you can call it).
          I will mark this post as solved since the hdd is behaving like it should and I didn't understand the behaviour.

          Jurgen
          Last edited by jurgen; Mar 09, 2020, 03:21 PM.

          Comment


            #6
            What I do is reserve user only space for backups for my users, then have a shared folder with a special group called "shared" (go figure). I mount this folder at each users home as the "public" folder. This makes it very clear that data is shared. Depending on how you mount the shared folder(s) you can control who can delete what while still allowing filesharing.

            Please Read Me

            Comment


              #7
              Originally posted by jurgen View Post
              I never realised that ext4 had these limitations (if that is what you can call it).
              Most of us would call this a "feature" ROFL...

              Please Read Me

              Comment


                #8
                POSIX filesystems (like ext4) were actually designed wtih multiuser systems in mind, so they are quite versatile (and can usually adjust to every need you have with multiple users and their access).

                Of course it's a bit hard to offer best recommendations without knowing your exact needs, but for example, you could put all your users in group "users" and give that group ownership/and read access to the directories you want to share with all of them (with write access), and your users could also have "private" directories on the drive that only them have write access to etc. and it is also possible to give users write access to everything if you wish.

                Comment

                Working...
                X