Economicalhost · Knowledge Base
Knowledge Base › Files & Backups › How to Password-Protect a Directory in cPanel
Files & Backups

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

  1. Open Files → Directory Privacy in cPanel.
  2. Navigate to the folder (click folder names to descend; click Edit beside the target folder).
  3. Tick "Password protect this directory" and give it a label (shown on the login prompt) → Save.
  4. Create a user: back on the same screen, enter a username and strong password under Create User → Save.
  5. Test in a private window: visiting any URL inside that folder now asks for the username and password.
  6. 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.