Title
Permission Denied Error When Writing to /app/data/.env During JWT Secret Initialization
Platform
Website - Chrome
Server Installation Method
Docker
Version
release-1.10.0
Troubleshooting
The Problem
Description:
When starting the container, the application fails to initialize the JWT secret due to a permission error when attempting to write to /app/data/.env. The error occurs in both Debian 12 and Unraid 7.1.4 environments.
[9:52:22 PM] [ERROR] [🗄️] Failed to initialize JWT secret [op:jwt_init_failed] Error: EACCES: permission denied, open '/app/data/.env' at async open (node:internal/fs/promises:641:25) at async Object.writeFile (node:internal/fs/promises:1215:14) at async SystemCrypto.updateEnvFile (file:///app/dist/backend/backend/utils/system-crypto.js:285:13) at async SystemCrypto.generateAndGuideUser (file:///app/dist/backend/backend/utils/system-crypto.js:184:9) at async SystemCrypto.initializeJWTSecret (file:///app/dist/backend/backend/utils/system-crypto.js:49:13) at async file:///app/dist/backend/backend/starter.js:76:9 { errno: -13, code: 'EACCES', syscall: 'open', path: '/app/data/.env' }
Environment:
Debian 12 (with Docker Compose)
Unraid 7.1.4
Workarounds Attempted:
Debian 12: Added user: "0:0" to docker-compose.yml to run container as root (high security risk).
Unraid 7.1.4: Set folder ownership to root (high security risk).
Root Cause Analysis:
The container's application (running as non-root user) lacks write permissions to the mounted volume /app/data. The .env file needs to be created/modified during JWT initialization, but the default container user cannot write to the mounted directory.
Security Concerns:
Current workarounds require running with elevated privileges or modifying permissions, which poses security risks. A more secure solution is needed.
How to Reproduce
services:
termix:
image: ghcr.io/lukegus/termix:latest
container_name: termix
restart: unless-stopped
ports:
- "8080:8080"
volumes:
- /usr/mydocker/termix/data:/app/data
environment:
PORT: "8080"
user: "0:0"
networks:
macnet:
ipv4_address: 192.168.xx.xx
ipv6_address: fdc7:xxxx:xxxx::20
networks:
test2:
external: true
Additional Context
No response
Title
Permission Denied Error When Writing to /app/data/.env During JWT Secret Initialization
Platform
Website - Chrome
Server Installation Method
Docker
Version
release-1.10.0
Troubleshooting
The Problem
Description:
When starting the container, the application fails to initialize the JWT secret due to a permission error when attempting to write to /app/data/.env. The error occurs in both Debian 12 and Unraid 7.1.4 environments.
[9:52:22 PM] [ERROR] [🗄️] Failed to initialize JWT secret [op:jwt_init_failed] Error: EACCES: permission denied, open '/app/data/.env' at async open (node:internal/fs/promises:641:25) at async Object.writeFile (node:internal/fs/promises:1215:14) at async SystemCrypto.updateEnvFile (file:///app/dist/backend/backend/utils/system-crypto.js:285:13) at async SystemCrypto.generateAndGuideUser (file:///app/dist/backend/backend/utils/system-crypto.js:184:9) at async SystemCrypto.initializeJWTSecret (file:///app/dist/backend/backend/utils/system-crypto.js:49:13) at async file:///app/dist/backend/backend/starter.js:76:9 { errno: -13, code: 'EACCES', syscall: 'open', path: '/app/data/.env' }Environment:
Debian 12 (with Docker Compose)
Unraid 7.1.4
Workarounds Attempted:
Debian 12: Added user: "0:0" to docker-compose.yml to run container as root (high security risk).
Unraid 7.1.4: Set folder ownership to root (high security risk).
Root Cause Analysis:
The container's application (running as non-root user) lacks write permissions to the mounted volume /app/data. The .env file needs to be created/modified during JWT initialization, but the default container user cannot write to the mounted directory.
Security Concerns:
Current workarounds require running with elevated privileges or modifying permissions, which poses security risks. A more secure solution is needed.
How to Reproduce
services:
termix:
image: ghcr.io/lukegus/termix:latest
container_name: termix
restart: unless-stopped
ports:
- "8080:8080"
volumes:
- /usr/mydocker/termix/data:/app/data
environment:
PORT: "8080"
user: "0:0"
networks:
macnet:
ipv4_address: 192.168.xx.xx
ipv6_address: fdc7:xxxx:xxxx::20
networks:
test2:
external: true
Additional Context
No response