Thank you for your donation!


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


[IDEA] allow sshfs mount remote storage (rights access issue solved for sshfs)
#16
@Phil35

I have a Music.local directory in my home directory on a Linux host that I use for testing various metadata schemes, file formats, etc. In the following test, I've edited in "me" for my actual username and "host" for the actual hostname. Also, although I prefer placing remote directories under /mnt/NAS, here I'm using /mnt/SDCARD to match your test. I've already created the subdirectory /mnt/SDCARD/SSHFS.

So, starting with a stock moOde 8.2.4 player on host m824p4b

Code:
#mount the remote directory using sshfs
pi@m824p4b:~ $ sudo sshfs -o allow_other,default_permissions me@host.local:/home/me/Music.local /mnt/SDCARD/SSHFS
me@host.local's password: <entered pw>

# look at the new entry at the end of the mounts
pi@m824p4b:~ $ mount
...
me@host.local:/home/me/Music.local on /mnt/SDCARD/SSHFS type fuse.sshfs (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other)

# check directories
pi@m824p4b:~ $ ls -la /mnt/SDCARD
total 16
drwxr-xr-x 4 root root 4096 Jan 18 15:26  .
drwxr-xr-x 4 root root 4096 Dec 28 17:45  ..
drwxr-xr-x 1 pi   pi   4096 Dec 11  2019  SSHFS
drwxr-xr-x 2 root root 4096 Dec 28 17:45 'Stereo Test'

pi@m824p4b:~ $ ls -la /mnt/SDCARD/SSHFS
total 16300
drwxr-xr-x 1 pi   pi       4096 Dec 11  2019  .
drwxr-xr-x 4 root root     4096 Jan 18 15:26  ..
drwxrwxr-x 1 pi   pi       4096 Dec 10  2019  2L.no
drwxrwxr-x 1 pi   pi       4096 Sep  1  2019 'Brahms, Johannes-Piano Concerto No 1 & Two Songs for Alto'
drwxrwxr-x 1 pi   pi       4096 Sep  1  2019 'Brahms, Johannes-Piano Concerto No 1 & Two Songs for Alto... '
drwxrwxr-x 1 pi   pi       4096 Dec 11  2019  dCS
drwxr-xr-x 1 pi   pi       4096 Jun  9  2019 'HDtracks 2018 Hi-Res Sampler'
drwxrwxr-x 1 pi   pi       4096 Sep 13  2019 'Johannes Brahms-Ein Deutsches Requiem, Op. 45'
drwxrwxr-x 1 pi   pi       4096 Sep  1  2019  MyFakeAlbum
-rw-rw-r-- 1 pi   pi   16652777 Apr 14  2014  Sample_BeeMoved_96kHz24bit.flac

I tell the moOdeUI to Update library and see the mpd log rolling as it adds the new files to its database

Code:
pi@m824p4b:~ $ tail -f /var/log/mpd/log
Jan 19 11:06 : update: added SDCARD/SSHFS/Johannes Brahms-Ein Deutsches Requiem, Op. 45/07.Selig sind die Toten.flac
Jan 19 11:06 : update: added SDCARD/SSHFS/Johannes Brahms-Ein Deutsches Requiem, Op. 45/02.Denn alles Fleisch.flac
Jan 19 11:06 : update: added SDCARD/SSHFS/Johannes Brahms-Ein Deutsches Requiem, Op. 45/06.Denn wir haben hie.flac
Jan 19 11:06 : update: added SDCARD/SSHFS/Johannes Brahms-Ein Deutsches Requiem, Op. 45/03.Herr, lehre doch mich.flac
Jan 19 11:06 : update: added SDCARD/SSHFS/Johannes Brahms-Ein Deutsches Requiem, Op. 45/04.Wie lieblich sind deine Wohnungen.flac
Jan 19 11:06 : update: added SDCARD/SSHFS/Johannes Brahms-Ein Deutsches Requiem, Op. 45/01.Selig sind, die da Leid tragen.flac
Jan 19 11:06 : update: added SDCARD/SSHFS/Johannes Brahms-Ein Deutsches Requiem, Op. 45/05.Ihr habt nun Traurigkeit.flac
Jan 19 11:06 : update: added SDCARD/SSHFS/MyFakeAlbum/08.Planos.flac
Jan 19 11:06 : update: added SDCARD/SSHFS/MyFakeAlbum/06.MarkIshamManyChinas.flac
...

The new tracks show up as appropriate in all moOdeUI views---don't forget to refresh the browser after updating the library--and I'm listening to a track now. Here's the audio info reported

Code:
SDCARD/SSHFS/Brahms, Johannes-Piano Concerto No 1 & Two Songs for Alto/01.Piano Concerto No 1 in D minor - 1 - Maestoso (Stephen Kovacevich, piano).flac

Now let's see what happens if I don't explicitly set any permissions in sshfs. First, reboot moOde just to clear the air and then

Code:
pi@m824p4b:~ $ sudo sshfs  me@host.local:/home/me/Music.local /mnt/SDCARD/SSHFS
me@host.local's password: <entered pw>

pi@m824p4b:~ $ ls -la /mnt/SDCARD
ls: cannot access '/mnt/SDCARD/SSHFS': Permission denied
total 12
drwxr-xr-x 4 root root 4096 Jan 18 15:26  .
drwxr-xr-x 4 root root 4096 Dec 28 17:45  ..
d????????? ? ?    ?       ?            ?  SSHFS
drwxr-xr-x 2 root root 4096 Dec 28 17:45 'Stereo Test'

Clearly, this is useless. At a minimum, sshfs -o allow_other is required. I added default_permissions out of habit but I don't think it's necessary (or may even be redundant).

Hope this helps.

Regards,
Kent
Reply


Messages In This Thread
RE: [IDEA] allow sshfs mount remote storage - by TheOldPresbyope - 01-19-2023, 04:43 PM

Forum Jump: