You are not logged in.

#1 2025-11-15 17:01:56

mr_kaddy
Member
Registered: 2025-10-24
Posts: 12

Cannot perform any operations on a USB stick without sudo

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:

  1. Mounting using:

    mount --mkdir /dev/abc /portable

    requires sudo or else it fails

  2. Copying any file using either of cp, rsync, mv etc requires a sudo

  3. Removing any file on the USB stick using rm requires a sudo

  4. 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.

  5. Unmounting using

    umount /portable

    requires 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

#2 2025-11-15 17:22:48

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,086

Re: Cannot perform any operations on a USB stick without sudo

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=value

https://man.archlinux.org/man/mount.8#M … ns_for_fat

Offline

Board footer

Powered by FluxBB