How do I make external drives readable and writable to all users when mounted?

Solution 1:

Note: I know nothing about Plex. The only thing I keep seeing in posts is that it runs as the user plex but that is my extent of knowledge.

In my test box when I ( user = tester ) attach a USB HDD it mounts to /media/tester/$UUID - accessible to tester but no one else.

One way to have universal access to any USB media is to use bindfs to create a "view" that allows it.

[1] Install bindfs:

sudo apt install bindfs

[2] Create a mount point for this "view":

sudo mkdir /MyMedia

[3] Temporarily remount /media/tester to /MyMedia using bindfs:

sudo bindfs /media/tester /MyMedia -o force-user=tester,force-group=tester,perms=666:+X

If I attach a USB HDD to the system it will now appear to be mounted twice:

** Once where Linux wants it to be mounted:

$ ls -al /media/tester ... drwxr-xr-x 3 tester tester 4096 Dec 31 1969 03E9-7C8D

** And again where bindfs mounts the "view" with a new set of permissions:

$ ls -al /MyMedia ... drwxrwxrwx 3 tester tester 4096 Dec 31 1969 03E9-7C8D

When I create the samba share I point it to /MyMedia

To undo the bindfs mount:

sudo umount /MyMedia

If it does what you want it to do you can have this bindfs "view" created at every boot by adding a line at the end of /etc/fstab - with a change of syntax:

/media/tester /MyMedia fuse.bindfs force-user=tester,force-group=tester,perms=666:+X,nonempty 0 0

Then unmount it if you still have it mounted:

sudo umount /MyMedia

Then make systemd happy:

sudo systemctl daemon-reload

Then mount it:

sudo mount /MyMedia

It should now mount that "view" at every boot.

Like I said at the top of this post I know nothing of Plex but it it wants all files to be owned by the user "plex" replace "force-user=tester" with "force-user=plex" in the bindfs mounts.