Bubka / 2FAuth

A Web app to manage your Two-Factor Authentication (2FA) accounts and generate their security codes
https://docs.2fauth.app/
GNU Affero General Public License v3.0
2.27k stars 151 forks source link

2fauth exited with code 1 - /2fauth/database.sqlite: Permission denied #385

Closed Iznogood1 closed 1 month ago

Iznogood1 commented 1 month ago

Version

5.0.3

Details & Steps to reproduce

When I run the container based on https://docs.2fauth.app/getting-started/installation/docker/docker-compose/

I get the following error:

2fauth | Running version 5.0.3 commit 35f2f1d built on 2024-01-19T14:54:35Z 2fauth | supervisord version: v0.6.8 2fauth | PHP 8.1.22 (fpm-fcgi) (built: Aug 3 2023 23:11:21) 2fauth | nginx version: nginx/1.22.1 2fauth | touch: /2fauth/database.sqlite: Permission denied 2fauth exited with code 1

It seems there is an issue with the premission to write de sqlite db...

Any thoughts?

Expectation

Get the db write persimmsion

Error & Logs

{"log":"touch: /2fauth/database.sqlite: Permission denied\n","stream":"stderr","time":"2024-09-19T07:29:43.203733388Z"}

Execution environment

No response

Containerization

Additional information

No response

Bubka commented 1 month ago

Hi,

You have to set the correct owner & permissions on /2fauth : https://docs.2fauth.app/getting-started/installation/docker/docker-cli/#docker-cli-setup

Iznogood1 commented 1 month ago

Shame on me the question was already raised and solved ; Sorry and thanks for your help.

It seems using the volumes statement in the docker-compose.yml can avoid to create a folder et change its owner and permissions

version: "3"
services:
  2fauth:
    image: 2fauth/2faut

    container_name: 2fauth
    volumes:
      - data:/2fauth`
 ...
volumes:
    data: