Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


write permission via ssh to locally attached exfat usb
#1
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?
Reply
#2
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
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
Thanks heaps!

Fantastic product, and support!
Reply
#4
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?
Reply
#5
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/d...nt-options
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#6
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?
Reply
#7
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 $
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: