Here's a couple of other ideas (unrelated to each other):
1) Put it in /etc/fstab, with "user" in the options list. Then you can mount it as you (user pi or whatever) and it will be owned by you.
You could but there are some things to be aware of:
- Using /dev/sda1 would allow any user to mount the first partition of the first drive regardless of if it's this one or not. It would also cause things to not work as expected if more than one USB storage device is connected.
- Best to inclue the noauto mount option too. if you don't systemd will try to mount it at boot, halt the system if that fails or mount it as root so the same problem exists unless you unmount it with sudo and remount it without.
- You may want to set the fstype in your fstab entry to auto and not include any filesystem specific mount options. This will help avoid errors should you try mounting a different device that's formatted to something else.
- If this should aply to only a single drive use PARTUUID not device node (/dev/sda1).
- "be owned by you" only applies to non-Linux filesystems. Yes, that applies in this specific case but not in all cases.
2) Let the automounter deal with it. I'm actually surprised that hasn't happened already. Maybe you are (shudder!) running "headless" ?
This has nothing to do with being headless. The automounter is a feature of the desktop and it requires that a user be logged in to the desktop in order to function. Even then it can be disabled. Lite version of the OS do not have an automounter. Full versions booting to the command line or booting to the desktop without automatic login do but it will not be active.
The automounter will also ignore anything present in fstab. That's another reason for using PARTUUID.
[shameless self promotion]
Using fstab A Beginner's Guide
[/shameless self promotion]
Statistics: Posted by thagrol — Thu Aug 01, 2024 1:15 pm