Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission Error #6

Closed
KimPig opened this issue Feb 17, 2023 · 8 comments · Fixed by #15
Closed

Permission Error #6

KimPig opened this issue Feb 17, 2023 · 8 comments · Fixed by #15
Labels
waiting for info Issue is waiting for info from users

Comments

@KimPig
Copy link

KimPig commented Feb 17, 2023

Permission Error occurs despite setting the PUID and PGID. I changed PUID and PGID to 0, but the same error occurs.

Setting up authentification for user USER1
Adding password for user USER1
Starting ownfoil
Traceback (most recent call last):
  File "/app/app.py", line 24, in <module>
    config = read_config(config_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/utils.py", line 22, in read_config
    with open(toml_file, mode="rb") as fp:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/games/shop_config.toml'

This is my docker-compose

version: "3"

services:
  ownfoil:
    container_name: ownfoil
    image: a1ex4/ownfoil
    environment:
      # For write permission in /games directory
      - PUID=1000
      - PGID=1000
      # Setup auth
      - USERNAME=USER1
      - PASSWORD=USER1
      # - ROOT_DIR=/games
    volumes:
      - /volume1/Waclan/게임/스위치:/games
    ports:
      - "268:80"
@a1ex4
Copy link
Owner

a1ex4 commented Feb 17, 2023

The PUID and PGID need to be set to the same user that owns the directory on the host, you can find out the user with:
ls -l /volume1/Waclan/게임/스위치

Then you can find the UID and GID with id <user>. Setting those in the docker-compose should fix your permission issue.

@KimPig
Copy link
Author

KimPig commented Feb 17, 2023

The PUID and PGID need to be set to the same user that owns the directory on the host, you can find out the user with: ls -l /volume1/Waclan/게임/스위치

Then you can find the UID and GID with id <user>. Setting those in the docker-compose should fix your permission issue.

Yes, but my id is 1026, but the error persists even if I set the PUID to 1026.
Setting PUID to 0 also results in permission error. Is there a possibility that it is a PGID problem?

@a1ex4
Copy link
Owner

a1ex4 commented Feb 17, 2023

You shouldn't set the PUID to 0, the container is made to run as a non root user.

The GID is also given by the id <user>, so you can try to set it as well.

Can you exec into the container and check the permission/owner of the /games directory? Please post the output of the following commands:

docker exec -it ownfoil bash
ls -l /games

@KimPig
Copy link
Author

KimPig commented Feb 17, 2023

Unable to execute the command because the container could not be executed due to a permission error.

I tried to set the GID to [100,101,65539] that came out when I ran id, but it didn't work.

@a1ex4
Copy link
Owner

a1ex4 commented Feb 19, 2023

Right, first override the container entrypoint by adding to the docker-compose:

    ports:
      - "268:80"
    entrypoint: "sleep infinity"

and then

docker-compose up -d
docker exec -it ownfoil bash
ls -l /games

@a1ex4 a1ex4 added the waiting for info Issue is waiting for info from users label Feb 21, 2023
@jimserio
Copy link

I'm having a similar issue. I'm using Unraid, which uses 99:100 (nobody:users) for shared directories. Setting the PUID:PGID to 99:100 results in the following error:

addgroup: gid '100' in use
chown: unknown user/group app:app
sudo: unknown user app
sudo: error initializing audit plugin sudoers_audit

Interestingly enough, the shop_config and shop_template files are copied over before the docker dies. If I set the PGID/UD to 1000:1000, the container will start the but the generated shop.json and shop.tfl, while generated, are owned by app:app which is unreadable by any user. Accessing the shop via the Switch just shows empty folders. The log only shows a simple GET /.

Any ideas?

@a1ex4
Copy link
Owner

a1ex4 commented Feb 22, 2023

I think I've figured out what happens, it's just that the base image (python-alpine) already has existing user that we are trying to add.

Can you please try the image a1ex4/ownfoil:fix-permission ? It should now handle this case and work as is.

@jimserio
Copy link

ownfoil:fix-permission

This has fixed this issue, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for info Issue is waiting for info from users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants