Home All hosting plans Shared hosting Managed WordPress Reseller hosting Care plans Agencies & resellers VPS & VDS Dedicated servers Domains Support Blog
Get started →
cPanel & Hosting

Password Protect a Directory in cPanel (5-Minute Trick)

Robert — HostDango.com · September 22, 2026 · 4 min read
Password Protect a Directory in cPanel (5-Minute Trick)

You can password protect a directory in cPanel in about five minutes, and it solves a problem that comes up constantly: a staging site that shouldn’t be public yet, a private client area, or a folder of files meant for one specific person rather than the entire internet. Here’s exactly how to do it.

TL;DR

Use cPanel’s Directory Privacy tool to password protect a directory in about five minutes, no plugin or code required. This works at the server level, so it protects staging sites, client folders, and private files regardless of what’s running inside them. Agencies managing multiple client staging environments benefit most from doing this consistently across every project.

Why You’d Want to Password Protect a Directory in cPanel

The most common reason: a staging version of a site, a working copy where changes get tested before going live on the real domain. Staging sites are frequently left completely open, meaning anyone who finds the URL, including search engines that crawl it accidentally, can see unfinished work or duplicate content competing with your actual site.

Other common reasons to password protect a directory in cPanel: a folder of deliverables for a specific client, an internal tool not meant for public use, or draft content you want a stakeholder to review before it’s public. It pairs naturally with good backup habits too, covered in our post on creating and restoring backups in cPanel, since a staging environment is exactly where you want a clean rollback point before pushing anything live.

How to Password Protect a Directory in cPanel

  1. Log into cPanel
  2. Under the Files section, next to File Manager, click Directory Privacy
  3. Navigate to the specific folder you want to protect, using the file browser shown
  4. Click on the folder name to select it
  5. Check the box labeled Password protect this directory
  6. Enter a name for the protected area, this is just a label shown in the login prompt, not a technical setting
  7. Click Save
  8. Under Create User, enter a username and password for whoever needs access
  9. Click Save again

Once this is done, anyone visiting that directory in a browser gets a login prompt before seeing any content at all. No username and password means no access, regardless of what’s actually inside the folder.

Password protecting a directory in cPanel, the full flow

Selectthe folderEnableprivacy toggleCreateuser + passwordSaveboth stepsProtectedlogin required

Adding More Than One User

If more than one person needs access, repeat the Create User step for each additional login. Every authorized user gets their own username and password rather than sharing one set of credentials, which makes it easy to revoke a single person’s access later without changing the password for everyone else.

Removing Password Protection Later

Go back to Directory Privacy, select the same folder, and uncheck the password protection box, then click Save. The directory becomes publicly accessible again immediately, exactly what you want once a staging site is ready to go live or a private review period is over.

Why Agencies Should Do This on Every Staging Site

If you manage websites for multiple clients, an unprotected staging environment is a real, avoidable risk. Search engines occasionally crawl and index staging URLs, competitors can stumble across unfinished redesigns, and client work in progress becomes visible before anyone intended it to be. Password protecting every staging directory as a standard step, not an occasional afterthought, closes that gap entirely.

This is exactly the kind of workflow that gets easier with reseller hosting, since each client gets a fully isolated cPanel account with its own Directory Privacy settings, rather than juggling staging folders across a single shared account. If you’re managing more than a handful of client sites and want a cleaner way to keep each one properly separated and protected, that’s worth a look.

Frequently Asked Questions

Does password protecting a directory in cPanel slow down the site?

No. It adds a login prompt at the server level before any content loads, but it has no meaningful effect on performance once access is granted.

Will this work for a WordPress staging site specifically?

Yes. Directory Privacy works at the web server level, independent of what’s running inside the folder, so it protects a WordPress install, a static HTML site, or any other type of content equally well.

Can search engines still index a password protected directory?

No. Since search engine crawlers can’t authenticate, a password protected directory is effectively invisible to them, which is exactly why this is the right tool for keeping staging sites out of search results.


If you manage staging environments for multiple clients and want to talk through the best way to keep them organized and protected, reach out and we’re happy to help you set it up right.

R
Robert
Founder & Operator — HostDango.com
Running HostDango.com since 1999. I manage the servers, write the posts, and answer the live chat. When something affects your hosting, you hear it from me directly.

Ready for hosting that just works?

27 years in business. Real humans. No drama. Starting at $4.49/mo.