How to give Transmission permissions to write on external HD on Raspbian Raspberry Pi media server?
I’ve installed Transmission on my Raspberry Pi with Raspbian on.
Want to download torrents (legally of course) to an external hard drive.
Permission is denied. root is owner and group for the drive
I’ve tried to change permissions on the drive following a lot of different instructions here and other forums but can’t make it. Found some information on that it’s impossible to change permissions on a disk with exFAT.
What workaround could I do?
My main user is "pi" and I think that’s the one Transmission uses.
EDIT: Add content to fstab
proc /proc proc defaults 0 0
PARTUUID=50913804-01 /boot/firmware vfat defaults 0 2
PARTUUID=50913804-02 / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
UUID=67E3-17ED /mnt/67E3-17ED auto defaults,nofail 0 0
UUID=652F-FA93 /mnt/652F-FA93 auto defaults,nofail 0 0
EDIT 2: lsblk –fs
$ lsblk --fs
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1 vfat FAT32 EFI 67E3-17ED 196,9M 0% /mnt/67E3-17ED
└─sda2 exfat 1.0 8TB 652F-FA93 5,8T 20% /mnt/652F-FA93
mmcblk0
├─mmcblk0p1 vfat FAT32 bootfs D3E6-3F09 436,8M 14% /boot/firmware
└─mmcblk0p2 ext4 1.0 rootfs cb6f0e18-5add-4177-ab98-e9f0235e06b3 42,7G 58% /
EDIT 3: Changed fstab
pi@raspberrypi:~ $ lsblk --fs
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
|-sda1
| vfat FAT32 EFI 67E3-17ED 196,9M 0% /mnt/67E3-17ED
`-sda2
exfat 1.0 8TB 652F-FA93 5,8T 20% /mnt/652F-FA93
mmcblk0
|-mmcblk0p1
| vfat FAT32 bootfs
| D3E6-3F09 436,8M 14% /boot/firmware
`-mmcblk0p2
ext4 1.0 rootfs
cb6f0e18-5add-4177-ab98-e9f0235e06b3 48,4G 54% /
pi@raspberrypi:~ $ ls -la /mnt
totalt 265
drwxr-xr-x 4 root root 4096 21 okt 16.28 .
drwxr-xr-x 18 root root 4096 10 okt 06.06 ..
drwxr-xr-x 4 root root 262144 7 nov 10.27 652F-FA93
drwxr-xr-x 2 root root 512 1 jan 1970 67E3-17ED
Thanks in advance for the help!
Apparently both the kernel and fuse exfat drivers use uid
/gid
for setting the transient ownership and umask
/fmask
/dmask
for setting the transient permission of the content of the mount (including the "root" of the mount).
So you have two options. If you do not need the mount to be write accessible by users other than pi
. You can use uid=pi
. (You can also add gid=pi
as well to make it like the usual case of you HOME
. And obviously, this allows you to add pi
as a supplementary group to other users that need to have write access to the mount.)
Certainly ownership alone does not necessarily imply the permission you need, but apparently the default fmask
and dmask
gives the owner rwx
on the files and directories. (But not the owner group, which is given r-x
by default; so gid=pi
alone is "useless" regarding the goal mentioned above.)
If you wish to change the transient permission instead of ownership, you can have something like fmask=0111,dmask=0000
, which gives all users rw-
on the files and rwx
on the directories. (You can even just set umask=0
, which would set both fmask
and dmask
to 0
, i.e., 0000
, unless you use any of options explicitly as well.)
1. You should confirm that you have the packages installed that are needed to handle EXFAT file systems:
$ sudo apt update
...
$ sudo apt install exfat-fuse exfat-utils
If they’re already installed, apt install
will inform you of this, and do nothing further.
2. Here’s the change that should probably be made to your /etc/fstab
file:
FROM:
UUID=67E3-17ED /mnt/67E3-17ED auto defaults,nofail 0 0
UUID=652F-FA93 /mnt/652F-FA93 auto defaults,nofail 0 0
TO:
UUID=67E3-17ED /mnt/67E3-17ED auto defaults,nofail 0 0
UUID=652F-FA93 /mnt/652F-FA93 auto uid=pi,gid=pi,defaults,nofail 0 0
I say probably because I don’t think you intended to download any torrents to your EFI (FAT) partition, so there’s no point in changing anything. In fact, you may not actually need to include the FAT partition in your /etc/fstab
file at all. But, if I’m wrong, you can give the FAT partition the same treatment you gave the EXFAT partition.
If repairing the permissions is all you’re interested in, you need not read the remainder of this answer. I include the remainder only to provide some background that may be helpful in the future (if your future includes such things as editing /etc/fstab
files 🙂
The cause of this permissions confusion when using EXFAT is basic: The EXFAT filesystem has no owner/permission metadata. The owner/permission data is set when the filesystem is mounted, and it cannot be changed (unless the filesystem is remounted). This is why you see questions from time-to-time asking why chown
and chmod
operations fail on an EXFAT partition.
We’ve seen that ownership of an EXFAT partition is set at mount time using the uid=
and gid=
parameters. Permissions may also be changed; the umask
, dmask
and fmask
parameters are used for this purpose.
All (or most) of this is covered in the system manual: man mount.exfat-fuse
. The challenge here is knowing the name of the manual! 🙂 Which brings up a few final points with respect to formulating an entry in /etc/fstab
:
-
I feel that use of the
auto
parameter in the third field (fs_vfstype) of/etc/fstab
is a mistake… if you’re using/editing/etc/fstab
you should at least know what file system type you’re going to mount! -
Likewise, I feel the same re use of the
defaults
parameter in the fourth field (fs_mntops). -
I dislike the use of UUIDs for identifying volumes to be mounted; a UUID is effectively a random number, and why use a random number to identify a volume to be mounted in
/etc/fstab
? … will you remember it next week? I much prefer LABELs for identifying mounts. In the case of an EXFAT partition, the command for creating a label is:
sudo exfatlabel /dev/sda2 "TORRENT_STORE"
Consequently, my final suggested change to your /etc/fstab
entry is this:
LABEL=TORRENT_STORE /mnt/652F-FA93 exfat uid=pi,gid=pi,rw,user,nofail 0 0