Moode Forum
write permission via ssh to locally attached exfat usb - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- Thread: write permission via ssh to locally attached exfat usb (/showthread.php?tid=6826)



write permission via ssh to locally attached exfat usb - piesmoke - 08-18-2024

Hi all,

Apologies if this question has been asked and answered already. I did my best to search the forum for a solution.

I have a Pi 4 running MoOde Audio from an SD card, and a 2TB external usb drive storing all my music. The usb drive is formatted as exFAT. I can see it mounted at /media. All works perfectly.

Basically, I want to copy files to the usb drive via ssh/sftp, as well as give other programs on the network permissions to write to it, but I get a permissions error. Samba works fine, but is not a viable alternative in this case.

From what I've read moode uses udisk-glue to mount usb drives, and I believe the config I need to edit is /etc/udisks-glue.conf

Can someone confirm that for me, and give me an idea of the syntax I need to add to give me the permissions I need?


RE: write permission via ssh to locally attached exfat usb - Tim Curtis - 08-18-2024

Yes, udisks-glue and /etc/udisks-glue.conf 

Try looking at the output of the mount command. It should look like below for an exfat drive.
Code:
/dev/sda1 on /media/EXFAT4 type exfat (rw,nosuid,nodev,noexec,noatime,nodiratime,fmask=0022,dmask=0022,iocharset=utf8,errors=remount-ro,uhelper=udisks)

The default fmask=0022,dmask=0022 permissions equate to 0755/-rwxr-xr-x That means that root (sudo) is needed if not the owner.

If you want to change the auto-mount permissions for exfat then add suitable dmask and fmask settings to the filter block. There are calculators on the net that do octal or rwx <-> mask


RE: write permission via ssh to locally attached exfat usb - piesmoke - 08-18-2024

Thanks heaps!

Fantastic product, and support!


RE: write permission via ssh to locally attached exfat usb - piesmoke - 08-27-2024

Okay, so only just now have I had a chance to test this. I'm afraid I still can't get the syntax right.
I want it to be mounted with the equivalent of 777 permissions, so I ussumed that I'm editing these lines from the config file...

match exfatdisks {
automount = true
automount_options = {noexec,nodev,noatime,nodiratime}
post_mount_command = '/var/www/util/automount.sh add_mount_udisks "%mount_point"'
post_unmount_command = '/var/www/util/automount.sh remove_mount_udisks "%mount_point"'

... and that I want to add something like...

fmask=0000,dmask=0000

... to it, but I'm not sure.

Could you please give me an example of the line and where it should go please?


RE: write permission via ssh to locally attached exfat usb - Tim Curtis - 08-27-2024

Add the params like below.


Code:
automount_options = {noexec,nodev,noatime,nodiratime,'dmask=0000','fmask=0000'}

Here's an article explains the mapping between umask and chmod 
https://askubuntu.com/questions/429848/dmask-and-fmask-mount-options


RE: write permission via ssh to locally attached exfat usb - piesmoke - 08-27-2024

Thanks Tim,

So I tried that. This is how it reads now...

match exfatdisks {
automount = true
automount_options = {noexec,nodev,noatime,nodiratime,'dmask=0000','fmask=0000'}
post_mount_command = '/var/www/util/automount.sh add_mount_udisks "%mount_point"'
post_unmount_command = '/var/www/util/automount.sh remove_mount_udisks "%mount_point"'
}

But now the drive doesn't mount at all. Am I missing something obvious?


RE: write permission via ssh to locally attached exfat usb - Tim Curtis - 08-27-2024

It's not obvious to me what might be happening on your end but I ran a quick test with an ExFat USB stick and using the stock udisks glue conf and no issues writing via SSH.

Code:
pi@moode9:~ $ mount | grep /dev/sda1
/dev/sda1 on /media/EXFAT4 type exfat (rw,nosuid,nodev,noexec,noatime,nodiratime,fmask=0022,dmask=0022,iocharset=utf8,errors=remount-ro,uhelper=udisks)

pi@moode9:~ $ cd /media/EXFAT4/

pi@moode9:/media/EXFAT4 $ sudo touch tim.txt
pi@moode9:/media/EXFAT4 $ ls
'Stereo Test'   tim.txt
pi@moode9:/media/EXFAT4 $