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)
#11
Obviously I'm living with moOde not being secure. I'm still concerned about storing credentials for other systems in moOde.

Using sshfs looks especially problematic to me because it involves actual ssh credentials. I guess one could always take the caveat emptor approach.

Whatever one thinks of the overall Samba security model, the password-less guest access to a share doesn't require local storage of security credentials. Yes, other modes are possible but that's not how I've configured my NAS'es for use with moOde.

As for NFS, I'm already on record in previous threads of not being a fan (but you don't need to hear old war stories).

I've taken up too much bandwidth; it's time for this old curmudgeon to retreat to his lair.

Regards,
Kent
Reply
#12
Hi,

I tought it was possible to mount localy the remote directory on /mnt/SDCARD using sshfs as I wrote. I think I am wrong?

@Tim Curtis I fully agree with for item 1. 2. and 3.
Note for raspberry, now when an image is installed the default pi user don't exist any more
A file named 'userconf.txt' must be created with one line:
username:encoded_password

Phil
Reply
#13
(01-18-2023, 07:00 PM)Phil35 Wrote: Hi,

I tought it was possible to mount localy the  remote directory on /mnt/SDCARD  using sshfs as I wrote. I think I am wrong?  

...
Phil

What isn't working?

I have no difficulty mounting a remote directory either to /mnt/NAS/SSHFS or to /mnt/SDCARD/SSHFS where, in both cases, I first created the /mnt/../SSHFS mountpoint in the moOde filesystem. This makes it much easier to unmount the remote directory after I'm done. 

Using either mountpoint, moOde (well, MPD actually) happily scans the new files and does all the usual things with them.

As an aside, I don't understand why you'd need to use the -p option, which specifies a port.

Regards,
Kent

ETA: Wait, recall what I said back in post #9 "...using sshfs with minimal options to allow others to access the directory besides its owner." What options are you using for permissions?
Reply
#14
We set the default password for user pi in an image builder conf file.
https://github.com/moode-player/imgbuild...cfg/config

A password change request for the user pi could be part of the first-use process in moOde. Something like below.

Code:
Create a password for the user pi [xxxxxxxxxxxxxxxx]"
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#15
Hi,
Thanks for your patience.
@TheOldPresbyope:
 -p  because even internaly default ports are not used in my home network so  ssh port number is not 22 but 54321, yes now you know one  secret
     but yes you're right by default the option -p is not needed,  because ssh default port number is 22.

@Tim Curtis:
   it works for you not for me ... this is normal isn't it you're the boss, the man who knows.
   
In the directory links are OK (see below).
I have done as you  ie   mkdir /mnt/SDCARD/SSHFS and then mount here.
however:
- on the web page .. only entries displayed are:
   NAS
   Default Playlist
   Favorites
no USB nor SDCARD
I tried to restart servers ie moodeutl -r  ,  then moodeutil -t  
but   no USB nor SDCARD are shown on the web page. What do I have done wrong?
 
Code:
20230119 135947 worker: -- Music sources
20230119 135947 worker: --
20230119 135947 worker: USB sources
20230119 135947 worker: No drives found
20230119 135947 worker: NAS sources
20230119 135947 worker: NAS
20230119 135948 worker: Mount all submitted
20230119 135948 worker: --

Code:
cd /var/lib/mpd/music
ls -lalt
total 24
drwxr-xr-x 4 mpd  audio  4096 Jan 19 13:50 ..
drwxrwxrwx 2 root root  12288 Sep 29 14:27 RADIO
-rwxrwxrwx 1 root root      6 May 31  2022 .mpdignore
drwxr-xr-x 3 root root   4096 May 31  2022 .
lrwxrwxrwx 1 root root      8 Mar 26  2022 NAS -> /mnt/NAS
lrwxrwxrwx 1 root root     11 Mar 26  2022 SDCARD -> /mnt/SDCARD
lrwxrwxrwx 1 root root      6 Mar 26  2022 USB -> /media
and
Code:
ls -lalrt mpd/music/SDCARD/
total 28
drwxr-xr-x 4 root root  4096 Jun 30  2022  ..
drwxrwxrwx 1 root root 16384 Nov 18 08:31  SSHFS
drwxr-xr-x 2 root root  4096 Jan 13 08:48 'Stereo Test'
drwxr-xr-x 4 root root  4096 Jan 19 13:43  .

 
Code:
mpd -V
Music Player Daemon 0.23.11 (r822prod-18-gb35b25b)
and

Code:
 moode-player                         8.2.4-1moode1
Reply
#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
#17
Hi,
Thank you @TheOldPresbyope
Good and bad news ...

good

Code:
I can see the update in mpd log ..
20230119 181626 worker: Job update_library
20230119 181626 mpdindex: Start
20230119 181626 mpdindex: Cmd (update "SDCARD")
20230119 181627 thumb-gen: Done: 2665 folders scanned, 0 thumbs created, 2665 already in cache.
20230119 181629 mpdindex: Done: indexed 1078 artists, 505 albums, 6947 songs
20230119 181629 worker: Job update_library done


bad
on the home page of moode, (of course I refresh the browser)
If I click on " SD CARD"   then only one entry "Stereo Test"   SSHFS not displayed


Code:
root@moode:/home/pi# ls -larlt /mnt/SDCARD/

total 28
drwxr-xr-x 4 root root  4096 Jun 30  2022  ..
drwxrwxrwx 1 root root 16384 Nov 18 08:31  SSHFS
drwxr-xr-x 2 root root  4096 Jan 13 08:48 'Stereo Test'
drwxr-xr-x 4 root root  4096 Jan 19 13:43  .


I tested with using sshfs   with user = root group = root and also (another test)  user = pi  group = pi .. nothing change  SSHFS still not displayed
I should see all songs twice
Code:
//192.168.6.237/music         2879621632 2002778124 876843508  70% /mnt/NAS/NAS
philippe@192.168.6.237:/music 2879621632 2002675724 876843508  70% /mnt/SDCARD/SSHFS

I'am sorry
Phil
Reply
#18
I'm away from my system now so just one comment.

The Library Folder view will show only the directories in which or below which the mpd scan found music tracks. SSHFS won't show up until the remote directory is mounted properly and the library updated.

Regards,
Kent
Reply
#19
Hi Kent,
Ok
Tested.

1/ remote directory mounted via sshfs on /mnt/SDCARD/SSHFS.
   Musics are there, files and directories are there ... update library sees nothing more
    I have click on "clear library tag cache" "regenerate thumbnail"
    I may read on the webpage "View Status" the scan is running ok in /mnt/SDCARD/SSHFS/........
    I may read a correct result with moodeutl -t 


Code:
20230121 164828 mpdindex: Done: indexed 1 artists, 1 albums, 1 songs
20230121 164828 worker: Job update_library done
20230121 164839 thumb-gen: Done: 1333 folders scanned, 0 thumbs created, 1333 already in cache 

However nothing better  the webpage still shows only "Stereo Test"

2/ umount /mnt/SDCARD/SSHFS
   copying some music files localy in /mnt/SDCARD/SSHFS,   update library  and music is there

   Good the webpage  shows now two entries  "SSHFS" and "Stereo Test" , entering SSHFS, music is there and can be played.

That's crazy, on this raspberry mpd do not find  the files and directories under /mnt/SDCARD/SSHFS when remote directory is mounted there.
As I already wrote, this is the same remote  than the mounted as NAS

Phil

fyi: I found a problem but nothing to deal with moode, got these errors messages, problem with around 20 files themselfves
Code:
20230121 164413 thumb-gen: Scanning: NAS, SDCARD
20230121 164424 thumb-gen: Error: File does not contain ID3v2 tag:
Reply
#20
(01-21-2023, 03:59 PM)Phil35 Wrote: Hi Kent,
Ok
Tested.

1/ remote directory mounted via sshfs on /mnt/SDCARD/SSHFS.
   Musics are there, files and directories are there ...

If you don't show details, I can only make guesses. What was the exact command you entered to mount the directory and how did you determine things "are there"? My first guess is that you have incorrect permissions on directories and/or files.

Quote:update library sees nothing more
    I have click on "clear library tag cache" "regenerate thumbnail"
    I may read on the webpage "View Status" the scan is running ok in /mnt/SDCARD/SSHFS/........
    I may read a correct result with moodeutl -t 


Code:
20230121 164828 mpdindex: Done: indexed 1 artists, 1 albums, 1 songs
20230121 164828 worker: Job update_library done
20230121 164839 thumb-gen: Done: 1333 folders scanned, 0 thumbs created, 1333 already in cache 

However nothing better  the webpage still shows only "Stereo Test"

This snippet of output from moodeutl reinforces my guess since there appears that only one album and track are found in this scan---e.g., the Stereo Test---and that your thumbnail cache already contained 1333 thumbs with no new ones added.

Quote:2/ umount /mnt/SDCARD/SSHFS
   copying some music files localy in /mnt/SDCARD/SSHFS,   update library  and music is there

   Good the webpage  shows now two entries  "SSHFS" and "Stereo Test" , entering SSHFS, music is there and can be played.

...

fyi: I found a problem but nothing to deal with moode, got these errors messages, problem with around 20 files themselfves
Code:
20230121 164413 thumb-gen: Scanning: NAS, SDCARD
20230121 164424 thumb-gen: Error: File does not contain ID3v2 tag:

This last tells you that MPD can't find metadata to index in these files (I suppose they are MP3 files). That's a problem for Album and Tag views but these files should still show up in the Folder view, just not nicely tagged.

ETA - oops - Obviously this error message relates not to MPD but to the thumbnail generator script which, among other things, checks for coverart which may be embedded in ID3v2 metadata. Still not a problem for the Folder view.

You can use mpc from the command line to explore the MPD database and status.
  • Try mpc help to see what the commands are.
  • mpc stats is a start
Candidly, I'm running out of time to spend on this. It's clear in tests I've run that sshfs is viable for remotely mounting music directories in moOde when configured properly. Now we're down into more mundane problems. For a start, see the MPD documentation, especially the subsection "I can’t see my music in the MPD database."

Good luck.

Regards,
Kent
Reply


Forum Jump: