How to Password-Protect a Directory in cPanel
Directory Privacy puts a browser login prompt in front of any folder — perfect for staging sites, private downloads, or an admin area's extra layer.
Step-by-step
- Open Files → Directory Privacy in cPanel.
- Navigate to the folder (click folder names to descend; click Edit beside the target folder).
- Tick "Password protect this directory" and give it a label (shown on the login prompt) → Save.
- Create a user: back on the same screen, enter a username and strong password under Create User → Save.
- Test in a private window: visiting any URL inside that folder now asks for the username and password.
- To remove protection, untick the box on the same screen and save.
💡 Good to know
- Protection covers everything inside the folder, including subfolders.
- Multiple users can be created for the same directory — one per person, so access can be revoked individually.
- This is HTTP Basic Auth over your SSL connection — fine as a gate for staging, but use application-level logins for genuinely sensitive data.