GeekFunkLabs / squishbox

Software and design files for a Raspberry Pi sound module enclosure
20 stars 3 forks source link

Web-based file manager - Root path not found #7

Closed cpu150 closed 6 months ago

cpu150 commented 6 months ago

Description

After a fresh install and reboot I got an error while trying to access the web-based file manager. After logging in this error message is shown: Root path "/home/cpu150/SquishBox" not found!

Web 404

Steps to reproduce

  1. Flash Raspberry Pi Os Lite (64-bit) (Debian Bookworm - no desktop environment) image
  2. Update system: sudo apt update ; sudo apt -y upgrade
  3. Install SquishBox as Naked Raspberry Pi Synth
  4. Reboot
  5. Access the Web-based file manager from a web browser
  6. Log in

Result: Get a not found error message Expected: Should display the Squishbox root folder content

Setup

Raspberry Pi Zero 2W:

Squishbox:

cpu150 commented 6 months ago

It seems to be a rights issue: My home directory is set as: drwx------ 4 cpu150 cpu150 4096 May 16 15:24 cpu150 If I change as chmod 750 ~: drwxr-x--- 4 cpu150 cpu150 4096 May 16 15:24 cpu150 then it works fine. Which makes sense nginx server is ran by www-data user.

The above allows us to confirm where the issue comes from however I would not recommend that as a solution as it introduces security issues. I don't have a proper solution for that. Maybe changing the default installation folder?

albedozero commented 6 months ago

Debian 12 Bookworm (or at least the Raspberry Pi OS version of it) causes this problem by using default permissions 700 (drwx------) for home directories. Up until Bullseye it was 755 (drwxr-xr-x), which works fine as long as www-data is added to the user's group.

I think the solution is to make sure directories in the path to SquishBox/, wherever it is installed, are group-executable (i.e. drwx--x---). That way www-data can traverse them but not write anywhere it isn't supposed to. Alternate default locations might be /usr/local/share/SquishBox or /srv/SquishBox, but those will require permission/ownership changes as well, and I feel like the home directory is the easiest place for users to find bank and config files if they log into the Pi.

cpu150 commented 6 months ago

Indeed: I just tried to give just the executable right and it sounds working fine (drwx--x---). I got your point and do agree: it's easier to find if in the home directory. Maybe a symbolic link could be a work around?

Also (but this connects with another big topic so happy to have it somewhere else than here), I have seen another project with the system in read only which makes it easier to shutdown (no way to corrupt a file so no need a command to power it off). If this sounds interesting to you then I would suggest to create another partition (rw) and install SquishBox files there while keeping the system partition as read only.

albedozero commented 6 months ago

fixed by #9