4

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?

user1816847
  • 143
  • 1
  • 4

1 Answers1

3

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