Score:2

can't add write permissions to mounted exFAT hard drive

tf flag

I have a fresh install of ubuntu 22.04 and an external USB hdd formatted as exFAT. I can write to it as root but I can't write to it as a user. I'd like to allow all users the ability to write to this drive. If I try to add write permissions nothing changes.

Here's the relevant line from /etc/fstab:

/dev/disk/by-id/usb-Hitachi_HDS5C3020ALA632_FFFACFF0FD000000FF4221F302FD4F-0:0-part1 /media/external auto nosuid,nodev,nofail,x-gvfs-show 0 0

and here's some example console output illustrating my issue:

touch: cannot touch 'external/foo.txt': Permission denied
x@x-U4:/media$ ls -al
total 520
drwxr-xr-x  3 root root   4096 Feb  6 21:12 .
drwxr-xr-x 20 root root   4096 Feb  5 11:29 ..
drwxr-xr-x  4 root root 524288 Feb  7 22:52 external
x@x-U4:/media$ chmod 777 external
chmod: changing permissions of 'external': Operation not permitted
x@x-U4:/media$ sudo !!
sudo chmod 777 external
x@x-U4:/media$ sudo chmod 777 external
x@x-U4:/media$ ls -al
total 520
drwxr-xr-x  3 root root   4096 Feb  6 21:12 .
drwxr-xr-x 20 root root   4096 Feb  5 11:29 ..
drwxr-xr-x  4 root root 524288 Feb  7 22:52 external
x@x-U4:/media$ sudo chmod o+w external/
x@x-U4:/media$ ls -al
total 520
drwxr-xr-x  3 root root   4096 Feb  6 21:12 .
drwxr-xr-x 20 root root   4096 Feb  5 11:29 ..
drwxr-xr-x  4 root root 524288 Feb  7 22:52 external
x@x-U4:/media$ touch external/foo.txt
touch: cannot touch 'external/foo.txt': Permission denied
x@x-U4:/media$ sudo touch external/foo.txt
x@x-U4:/media$ ls external/*.txt
external/foo.txt

Any idea whats going on and how I can let users write to /media/external?

Score:2
us flag

To enable write permissions for all users, change the /etc/fstab line to the following.

/dev/disk/by-id/usb-Hitachi_HDS5C3020ALA632_FFFACFF0FD000000FF4221F302FD4F-0:0-part1 /media/external auto rw,user,uid=1000,dmask=0000,fmask=0000,nosuid,nodev,nofail,x-gvfs-show 0 0

ref: "dmask" and "fmask" mount options

user1816847 avatar
tf flag
This answer combined with the explanation of the dmask and fmask got me to my answer. https://askubuntu.com/questions/429848/dmask-and-fmask-mount-options to get exactly what i wanted I didn't need the uid set and dmask and fmask need to be 000, though i decided to choose a slightly more conservative mask in the end
us flag
@user1816847 Feel free to edit the answer. That will help other people in the future.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.