ihexxa / quickshare

Quick and simple file sharing between different devices, built with Go, React and Typescript.
https://ihexxa.github.io/quickshare.site
GNU Lesser General Public License v3.0
506 stars 32 forks source link

panic: open quickshare.db: permission denied #127

Closed WLun001 closed 2 years ago

WLun001 commented 2 years ago

hitting permission denied with custom config

docker-compose.yml

version: '3'
services:

  quickshare:
    image: hexxa/quickshare:latest
    container_name: quickshare
    restart: always
    ports:
      - "8686:8686"
    user: 1000:1000

    environment:
      DEFAULTADMIN: admin
      DEFAULTADMINPWD: LsC9QU5Mj3QJywE
    volumes:
      - ./quickshare:/quickshare/root
      - ./config.yml:/quickshare/docker.yml

config.yml

users:
  captchaEnabled: false

Output

 docker compose up
[+] Running 1/1
 ⠿ Container quickshare  Recreated                                                                                 1.1s
Attaching to quickshare
quickshare  | panic: open quickshare.db: permission denied
quickshare  |
quickshare  | goroutine 1 [running]:
quickshare  | github.com/ihexxa/quickshare/src/kvstore/boltdbpvd.New(0xc0004834d0, 0xd, 0x400, 0x0)
quickshare  |   /quickshare/src/kvstore/boltdbpvd/provider.go:31 +0x298
quickshare  | github.com/ihexxa/quickshare/src/server.initDeps(0xccecc0, 0xc000490320, 0xc)
quickshare  |   /quickshare/src/server/server.go:140 +0x445
quickshare  | github.com/ihexxa/quickshare/src/server.NewServer(0xccecc0, 0xc000490320, 0x0, 0x0, 0x2)
quickshare  |   /quickshare/src/server/server.go:54 +0x8c
quickshare  | main.main()
quickshare  |   /quickshare/cmd/start/main.go:26 +0x11f
quickshare exited with code 2
quickshare exited with code 2
quickshare exited with code 2
quickshare exited with code 2

The volume ./quickshare has the correct owner

Without the volume mount config, it will run smoothly

ihexxa commented 2 years ago

That's weird, I'll check it.

Happy Spring Festival~

WLun001 commented 2 years ago

新年快乐

ihexxa commented 2 years ago

Hi @WLun001 I've noticed that you set the user account for running docker.

 user: 1000:1000

Currently no default user is created in the Quickshare docker image, so the process is owned by root internal the docker. I guess the quickshare.db in the volume is owned by the root, then the action (opening db by uid=1000) is rejected.

I'll add a patch to create a default user and group in the image.

One quick workaround might removing user: 1000:1000 so it will be started by the root in the docker. Let me know if it doesn't work.