WordPress wp-config.php Permission Is Too Open
A practical guide to checking wp-config.php ownership, read access, direct web access, and host-specific permission rules without breaking the site.
Quick answer
If wp-config.php permissions look too open, check ownership before changing modes. The file should be readable only by the account and web-server context that genuinely need it, should not be world-writable, and should not be directly downloadable from the web. Confirm the safest permission model with your host because shared, managed, VPS, and containerized WordPress setups can differ.
Problem, cause, fix, verify
Problem
If wp-config.php permissions look too open, check ownership before changing modes. The file should be readable only by the account and web-server context that genuinely need it, should not be world-writable, and should not be directly downloadable from the web. Confirm the safest permission model with your host because shared, managed, VPS, and containerized WordPress setups can differ.
Why it matters
Configuration, logs, status codes, and source-backed implementation details.
Safe check
Read logs and order notes
Verify
Avoid broad changes without a rollback path
Editorial trust
- Author
- WPlura Editorial Team
- Last reviewed
- Next review
- Sources
- 4 cited references
On this page
Technical reference
Check evidence before changing configuration
Configuration, logs, status codes, and source-backed implementation details.
Why wp-config.php Permissions Matter
wp-config.php is not an ordinary WordPress file. It can contain database credentials, authentication salts, table-prefix details, debug settings, custom constants, and environment-specific configuration. If the file is readable by the wrong system user, writable by too many accounts, or reachable through the web server, a small permission mistake can become a serious security exposure.
The right fix is not a universal chmod command copied from a forum. WordPress installations run under different hosting models: shared hosting with suexec, managed WordPress, VPS accounts, containers, deploy pipelines, and hosts where the web server user differs from the file owner. You need to know who owns the file, who must read it for PHP to run WordPress, and who should never be able to modify or download it.
Check the Current State First
- Record the current owner, group, and permission mode for wp-config.php before changing anything.
- Confirm whether wp-config.php is inside the web root or one directory above the WordPress installation.
- Ask the host which user PHP runs as and whether the web server needs group read access on this file.
- Check whether a direct browser request for wp-config.php is denied rather than downloaded or displayed.
- Look for backup copies such as wp-config.php.bak, wp-config.old, config.txt, or editor swap files in public folders.
- Confirm debug logging does not expose database credentials, server paths, salts, or stack traces in public locations.
How to Fix Open wp-config.php Permissions
- Take a backup or snapshot before editing permissions or server rules.
- Remove world-write access immediately if the file is writable by everyone.
- Set the file so only the required owner and server context can read it. On many systems this may be stricter than ordinary 644 files, but the correct value depends on the host.
- If your host supports it safely, place wp-config.php one directory above the WordPress install so it is outside the public document root.
- Add direct-access protection at the server layer where appropriate, such as a web-server rule denying requests for wp-config.php.
- Remove public backup copies, temporary files, old exports, and duplicate config files after preserving evidence and confirming they are no longer needed.
- Reload the site and wp-admin immediately after every change. If WordPress cannot connect to the database, restore the previous permission mode and ask the host which account must read the file.
The practical target is simple: WordPress should be able to read wp-config.php when PHP runs, administrators should be able to manage it through approved server access, and anonymous visitors should never be able to download it. Avoid permission changes that make the file writable by unrelated users or readable by every account on a shared server.
After the site still loads, test a direct request to the file and one authenticated wp-admin request. The right outcome is boring: WordPress can read configuration through PHP, administrators can manage the file through approved server access, and anonymous web requests cannot retrieve the file contents or backup copies.
Common Mistakes
- Do not use 777 on wp-config.php. That gives far more access than the file should ever need.
- Do not assume every host can use the same 400 or 440 setting; test and follow the host's PHP/user model.
- Do not leave editor backups, deployment copies, or compressed archives containing wp-config.php in public folders.
- Do not expose raw debug output while testing permission changes on a live site.
- Do not treat a green scanner result as proof the file is secure forever; deployment and backup tools can recreate risky copies later.
How Web Plura Security Center Helps
Web Plura Security Center is useful for this workflow because it focuses on local security evidence inside WordPress. The free plugin includes local security scans, risky configuration review, relevant file-permission signals, executable-file checks in upload locations, debug-log exposure indicators, public archive indicators, recent component changes, file-integrity context, incident visibility, reports, and administrative guidance.
Use it after you record the current permission state. Run a local review, compare findings with your host-level checks, then document what changed and why. Security Center does not promise automatic repair for every permission problem, does not guarantee every compromise will be detected, and does not upload suspicious file samples or local security reports to Web Plura Cloud by default.
Technical reference support tool
Web Plura Security Center
Free local WordPress security review for suspicious files, risky configuration, file-permission signals, executable uploads, debug-log exposure, public archive indicators, file-integrity context, firewall controls, local findings, privacy tools, and incident visibility inside WordPress.
Prevent the Problem From Returning
- Add wp-config.php permission checks to launch, migration, staging-push, and backup-restore checklists.
- Review backup plugin destinations so archives containing wp-config.php are not written into public folders.
- Disable dashboard file editing where appropriate so compromised admin access cannot directly edit theme or plugin PHP files.
- Keep a short record of the approved owner, group, permission mode, and host-specific reason.
- Rerun permission and public-archive checks after changing hosts, deployment tooling, backup plugins, or file ownership.
Also review deployment scripts, backup restores, and file manager workflows after the immediate fix. Many wp-config.php exposures return when a restore recreates old permissions, a backup plugin writes an archive into a public directory, or a developer downloads a copy and leaves it beside the live file. Add those checks to the same maintenance note as the approved owner, group, and permission mode.
References
References
- Changing File Permissions - WordPress Developer Resources, accessed 2026-09-17
- Hardening WordPress - WordPress Developer Resources, accessed 2026-09-17
- Editing Files - WordPress Developer Resources, accessed 2026-09-17
- Web Plura Security Center - WordPress.org Plugin Directory, accessed 2026-09-17
Frequently Asked Questions
What permission should wp-config.php use?
There is no one value that fits every host. The file should be readable only by the required owner and server context, not world-writable, and not directly downloadable. Many hosts support stricter permissions than ordinary files, but you should confirm the safe value for your hosting model.
Can I move wp-config.php outside the public web root?
WordPress can support wp-config.php one directory above the installation in common setups, but not every deployment layout is the same. Test carefully and keep rollback access available before moving it.
Can Web Plura Security Center automatically fix wp-config.php permissions?
Web Plura Security Center helps surface local security findings and file-permission context. Permission changes should remain human-owned because the safe value depends on hosting ownership, PHP user context, and server configuration.