Hi,
no matter what I try, I always get 403 Forbidden when trying to access the Piwigo ui via a local port.
I’ve tried chmod -R 777 on the folder and made sure folder is owned by current user. I’ve also tried replacing docker secrets with plain text for the Piwigo container. I’ve successfully run the container a while back, so I really don’t know what could be wrong. Here’s my docker compose.
Someone has an idea what could be wrong?
I am assuing their (PUID and PGID) values are 1000. can you please run a ‘grep 1000 /etc/passwd’ and ‘grep 1000 /etc/group’ on the host and verify they do exist ?
Als, what happens if you hardcode a value of 0 to those variables in the docker-compose file itself and run ? do you still get 403 error ?
Also can you run a ‘ls -lR $USERDIR/docker/photo’ and confirm that’s right path ?
My suggestion for setting 0 to PUID and PGID is only for debugging purpose Also, I would first hardcode all the values defined in .env file in the docker-compose file itself, make sure it runs as expected, and then move them to .env file. Nothing suggesting that’s the right approach but that’s just me
Thanks for the suggestions!
Yes, PUID and PGID are both 1000
$ grep 1000 /etc/passwd
odroid:x:1000:1000:,,,:/home/odroid:/bin/bash
$ grep 1000 /etc/group
odroid:x:1000:
$ ls -IR photo
app db gallery
I had also already thought of running the container as root for debugging, but as @driz already pointed out the container didn’t like that.
By the way, I forgot to mention that the nginx error.log says something like ‘directory index of gallery forbidden’ and there’s only one folder in /config/www/gallery and that’s called /galleries, which is empty, and nothing else.
As for hardcoding all the .env values into the docker-compose file itself: I have a lot of other containers running successfully with similar configurations. After failing to get Piwigo running, I successfully setup photoprism and pigallery2.
Here’s the container log:
today at 21:33:18s6-rc: info: service s6rc-oneshot-runner: starting
today at 21:33:18s6-rc: info: service s6rc-oneshot-runner successfully started
today at 21:33:18s6-rc: info: service fix-attrs: starting
today at 21:33:18s6-rc: info: service 00-legacy: starting
today at 21:33:18s6-rc: info: service 00-legacy successfully started
today at 21:33:18s6-rc: info: service fix-attrs successfully started
today at 21:33:18s6-rc: info: service legacy-cont-init: starting
today at 21:33:18cont-init: info: running /etc/cont-init.d/01-envfile
today at 21:33:18cont-init: info: /etc/cont-init.d/01-envfile exited 0
today at 21:33:18cont-init: info: running /etc/cont-init.d/02-tamper-check
today at 21:33:18cont-init: info: /etc/cont-init.d/02-tamper-check exited 0
today at 21:33:18cont-init: info: running /etc/cont-init.d/10-adduser
today at 21:33:18
today at 21:33:18-------------------------------------
today at 21:33:18 _ ()
today at 21:33:18 | | ___ _ __
today at 21:33:18 | | / __| | | / \
today at 21:33:18 | | \__ \ | | | () |
today at 21:33:18 |_| |___/ |_| \__/
today at 21:33:18
today at 21:33:18
today at 21:33:18Brought to you by linuxserver.io
today at 21:33:18-------------------------------------
today at 21:33:18
today at 21:33:18To support LSIO projects visit:
today at 21:33:18https://www.linuxserver.io/donate/
today at 21:33:18-------------------------------------
today at 21:33:18GID/UID
today at 21:33:18-------------------------------------
today at 21:33:18
today at 21:33:18User uid: 1000
today at 21:33:18User gid: 1000
today at 21:33:18-------------------------------------
today at 21:33:18
today at 21:33:18cont-init: info: /etc/cont-init.d/10-adduser exited 0
today at 21:33:18cont-init: info: running /etc/cont-init.d/20-config
today at 21:33:18cont-init: info: /etc/cont-init.d/20-config exited 0
today at 21:33:18cont-init: info: running /etc/cont-init.d/30-keygen
today at 21:33:18generating self-signed keys in /config/keys, you can replace these with your own keys if required
today at 21:33:18Generating a RSA private key
today at 21:33:18...+++++
today at 21:33:19.............................................+++++
today at 21:33:19writing new private key to '/config/keys/cert.key'
today at 21:33:19-----
today at 21:33:19cont-init: info: /etc/cont-init.d/30-keygen exited 0
today at 21:33:19cont-init: info: running /etc/cont-init.d/40-install
today at 21:33:19cont-init: info: /etc/cont-init.d/40-install exited 0
today at 21:33:19cont-init: info: running /etc/cont-init.d/90-custom-folders
today at 21:33:19cont-init: info: /etc/cont-init.d/90-custom-folders exited 0
today at 21:33:19cont-init: info: running /etc/cont-init.d/99-custom-files
today at 21:33:19[custom-init] no custom files found exiting...
today at 21:33:19cont-init: info: /etc/cont-init.d/99-custom-files exited 0
today at 21:33:19s6-rc: info: service legacy-cont-init successfully started
today at 21:33:19s6-rc: info: service init-mods: starting
today at 21:33:19s6-rc: info: service init-mods successfully started
today at 21:33:19s6-rc: info: service init-mods-package-install: starting
today at 21:33:19s6-rc: info: service init-mods-package-install successfully started
today at 21:33:19s6-rc: info: service init-mods-end: starting
today at 21:33:19s6-rc: info: service init-mods-end successfully started
today at 21:33:19s6-rc: info: service init-services: starting
today at 21:33:19s6-rc: info: service init-services successfully started
today at 21:33:19s6-rc: info: service legacy-services: starting
today at 21:33:19services-up: info: copying legacy longrun cron (no readiness notification)
today at 21:33:19services-up: info: copying legacy longrun nginx (no readiness notification)
today at 21:33:19services-up: info: copying legacy longrun php-fpm (no readiness notification)
today at 21:33:19s6-rc: info: service legacy-services successfully started
today at 21:33:19s6-rc: info: service 99-ci-service-check: starting
today at 21:33:19[ls.io-init] done.
today at 21:33:19s6-rc: info: service 99-ci-service-check successfully started
Since the container be will running under user ‘odroid’ (because of PUID and PGID being 1000), I would think, the directories and subdirectories under $USERDIR should also be owned by ‘odroid’.
Under what your user account have you logged into and running your docker-compose ? odroid ?
Thanks! But like I said, I already tried ‘chown odroid’ on the whole ‘photo’ directory, as well as chmod 777 and 775.
I’m logged in as odroid, correct.
The variable $USERDIR is only defined in the docker .env file, so my shell doesn’t know it (is that the correct expression?). The output of ls -IR photo (with current directory being $USERDIR/docker = /media/sdcard/docker) I already posted above (it’s just the names of the three folders in ‘photo’). What would you hope to see from that?
If the directories and subdirectories (which you pass as bind mount) are owned by the user ‘odroid’, and if you are running your program as user ‘odroid’, and if the directories and subdirectories are owned by 1000:1000 (which is odroid) within the container’s point of view, I am not sure why there is a 403 forbidden error. My apologies. I too am at lost
I think I am now getting obsessed with this problem I am trying to understand the role of /media/sdcard/docker ? Does it mean you are having all your pictures in your sdcard and then trying to use Piwigo to show the picture gallery ? I would still be interested in seeing of this command’s output when issued on host as an odroid user - ‘ls -lR /media/sdcard/docker.’ or ‘ls -l /media/sdcard/docker.’ (the exact output)
I still believe file persmissions are the root cause of 403 error though I am not able to prove it
Oh that’s a lower-case “l” in the command! I had always read it as a capital “i”
The location /media/sdcard/docker is where I have all my docker related stuff (volumes, docker-compose,…).
I won’t paste the output of ‘ls -lR’ from that folder (too much and not sure what it all contains) but from the folder with the piwigo volumes inside:
Before you point out the ‘permission denied’ stuff, consider that I have several other instances of mariadb running, which work just fine with the exact same settings.
Also consider that I already tried ‘sudo chmod -R 777’ and ‘sudo chown -R odroid:odroid’ on the whole /media/sdcard/docker/photo’ folder (in the output above it’s now called photo1).
If it really is a faulty permission setting on my side, then something must have gone really weird. Although I don’t have any in-depth skills concerning docker (or linux for that matter), all my other containers run without problems.
Unless this matter is now of personal importance to you, I’m going to stop looking into this (I tried photoprism as an alternative and I’m super satisfied)
I agree it’s a wise decision to let it pass and move on Thanks for sharing about photoprism. I am no expert by any means. Just an average docker user. Thanks again.