FATAL: data directory "/var/lib/postgresql/data" has invalid permissions — Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).
PostgreSQL refuses to start because the data directory is too open or owned by the wrong user.
Seen on:
PostgreSQL
Meaning
Common with Docker bind mounts on Windows/macOS or after copying data with root.
Common causes
- Bind mount with wrong ownership/permissions (Docker on Windows/macOS)
- Data copied as root
- chmod -R 777 applied
⚡ Quick fix
- chown -R postgres:postgres and chmod 700 the data directory
- Use a named Docker volume instead of a host bind mount
Detailed fix by platform
Docker
volumes: [pgdata:/var/lib/postgresql/data] # named volume
How to diagnose
- Owner — ls -ld data dir
- Mode — 0700?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026