Mounting an exfat partition on boot and giving everyone rw access

This is always a tricky problem for me… I have an exfat hard drive that I would like to have my PC mount on boot. But when I add the following line to /etc/fstab,

UUID=749F-FF5A /mnt/magnetodrive exfat defaults,user 0 0

the drive does mount, but my user (as well as other users) do not have permission to write to it. Only root does. However, this is an exfat filesystem, permissions shouldn’t matter. What’s the correct way of allowing everyone to write to this mount point?

UUID=749F-FF5A   /mnt/magnetodrive   exfat   defaults,user,fmask=000,dmask=000   0   0
  • The directory /mnt is a predefined location for temporary mounts - so avoid using it for permanent mounts.

  • Only when you share partitions across users it is preferable to use a location outside the /home structure.

2 Likes

is there another directory meant for permanent mounts, or is it better to make one myself?

I was always under the impression that /mnt is for permanent mounts, while /media was for temporary mounts. This used to be the case a while back where DE’s would mount USB sticks in /media… But it seems systemd now puts them in /run. I don’t know anymore.

This works for my user, but other users on the same system could not write to it. Though, it’s much better than not working for any user except root :slight_smile:

No, /mnt is for temporarily mounting filesystems which are not part of the regular filesystem hierarchy — originally it was for floppy disks. Later on it was intended for non-removable filesystems which are not part of the normal hierarchy, while /media was added for removable devices such as floppies, optical media and USB sticks.

However, in Manjaro and other systemd-based distributions there is no /media anymore, because removable storage is by default automatically mounted to /run/media.


That’s because the mountpoint /mnt has 755 permissions. If you want everyone to be able to write to it, then you need to create a mountpoint with 777 permissions.

For more information, please see the two tutorials below… :arrow_down:

Got it, thanks for all the information. Much appreciated!

After some reading and experimentation, I moved my mountpoint to /magnetodrive and set the ownership to root and permissions to 777. Then I used the following line.

UUID=749F-FF5A /magnetodrive exfat defaults,user,umask=000,fmask=000,dmask=000 0 0

This seems to work the way I intended. I realize that allowing any user to read/write/execute/delete inherently comes with some risk, but I feel that this risk is minimal for a home system, and the conveniences of a simplified permission scheme and cross compatibility with Windows (to which I dual boot for occaisonal gaming) is worth it

2 Likes

Well now I got another question…

One of the reasons I wanted to mount the exfat partition in the first place in such a manner is to get Steam to store some games on it.

When I add the partition to steam, it performs a test to see if it can run executables from it. However it gets a permission denied error, so it fails.

I tried to do this myself… I added a small script to the partition, and I was able to store it, but not execute it. This is despite the file having 777 permissions due to the umask/fmask/dmasks. Why is that?

Yep, it’s because you’ve added user to the mount options. user automatically also implies the mount options noexec,nodev.

Given that the filesystem is automatically mounted at boot time, there’s no point in having user among the mount options.

Note: After changing the mount options in /etc/fstab, you have to remount it in order for the changes to take effect. :arrow_down:

sudo mount -o remount /magnetodrive
1 Like

ah! I missed that. I was under the impression that user allows any non-root user to mount/umount the drive, which seemed like a convenient feature to have.

Steam is working with the drive now. Thank you very much!

1 Like

Not any non-root user; only the user who mounted it in the first place.

The users option — plural — allows any user to unmount it, even if it was mounted by another user, but here too this implicitly sets noexec,nodev.

1 Like

I would use this:
UUID=749F-FF5A /mnt/magnetodrive exfat exec,auto,nofail,noatime,uid=1000,gid=1000,dmask=0022,fmask=0133 0 0

And then just use sudo to mount and unmount if needed.

If it doesn’t work to execute, change fmask to 0033.

Reason: setting mask to 0000 opens up so ANYONE can do ANYTHING to that filesystem.

fmask=0133 would not be appropriate for what the OP wants. :wink:

That is what the OP wants. :stuck_out_tongue:

1 Like

No, he wants to run steam games, steam is run with the user.

But he wants to be able to write to it, so that he can move his steam games to that filesystem as a user, without needing to be root.

fmask 0033 if the exec flag is not enough.

Look, if you want to recommend him to set credentials to 777 go ahead, I do NOT agree with that.

I wouldn’t do it that way either, but the OP explicitly stated that this is what they want to do. :arrow_down:

2 Likes

@bedna Honestly I just want to keep the access as simple and dumbed down as possible. It’s a big mass storage device and I want to treat it that way without needing to deal with permissions, hence formatting it as exfat. I understand your concern for security, but this is a home PC, not a server, so I think it’s fine.

I got two users, possibly more in the future, working on this PC and I don’t really want anyone to get permission issues with it. It would act like a shared area between users and OS’s. I want it to work exactly like how it does on Windows: it shouldn’t matter who gets access to it, and executables can be run from it just fine.

Thanks for the help and advice, I really appreciate it

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.