Configuring .env File Permissions on Linux VPS
On your CloudPanel or standard Linux VPS, ensure only the application user (e.g., `www-data` or `site-user`) can read the `.env` file:
```bash
chmod 600 /home/site-user/htdocs/app/.env
chown site-user:site-user /home/site-user/htdocs/app/.env
```
This prevents unauthorized system users or compromised web services from reading credentials.
Frequently Asked Questions
What happens if a secret is accidentally committed to Git?
Treat it as immediately compromised. Rotate the secret immediately in production, revoke active sessions, and rewrite Git history using git-filter-repo or BFG Repo-Cleaner.