You are not logged in.
I have a USB stick which I have formatted to exfat and I wish to use it primarily to transfer files (so no booting/disk images are involved). But I cannot do a single thing without privilege escalation. Let's call the block device /dev/abc and the mount point as /portable. Then:
Mounting using:
mount --mkdir /dev/abc /portablerequires sudo or else it fails
Copying any file using either of cp, rsync, mv etc requires a sudo
Removing any file on the USB stick using rm requires a sudo
Changing the ownership of files or the entire /portable directory requires sudo and it fails. The owner is always root and it is impossible to change it to anything else using chown.
Unmounting using
umount /portablerequires sudo
I need to keep the filesystem as exfat for this stick because I intend to use this across multiple devices. I believe Unix permissions might be an issue. A solution proposed on other forums seems to be to use udisks2 or udiskctl instead of mount to manage external devices. I personally do not wish to use this solution because I want to understand why the above behaviour happens and how does a different tool bypass the challenges, because different tools use the same low-level syscall APIs at their core.
How do I avoid having to sudo for every operation with my USB stick and why does this behaviour happen?
Offline
requires sudo or else it fails
Yes.
Copying any file using either of cp, rsync, mv etc requires a sudo
As a direct consequence of (1) - *fat doesn't have any kind of real access control
use udisks2 or udiskctl instead of mount to manage external devices. I personally do not wish to use this solution because I want to understand why the above behaviour happens and how does a different tool bypass the challenges
Compare the output of "mount" for each approach and notice the differences in
uid=value and gid=value
Set the owner and group of all files. (Default: the UID and GID of the current process.)
umask=value
Set the umask (the bitmask of the permissions that are not present). The default is the umask of the current process. The value is given in octal.
dmask=valueOffline