Braysons Host logo
Order NowGet Started Free
Hosting Setup Guides

How to Password-Protect a Directory in cPanel

Restrict access to sensitive folders on your website using cPanel's built-in directory privacy feature.

4 min read
Updated 10 August 2026

Password-Protecting a Directory

Use directory password protection to restrict access to admin areas, client portals, staging sites, or any folder you want to keep private.

Step 1 — Open Directory Privacy

  1. Log into cPanel
  2. Go to Files → Directory Privacy

Step 2 — Select the Directory

Navigate to the folder you want to protect (e.g., public_html/admin or public_html/staging). Click the Edit (pencil) icon next to it.

Step 3 — Enable Password Protection

  1. Check Password protect this directory
  2. Enter a Label (e.g., "Admin Area — Authorised Users Only")
  3. Click Save

Step 4 — Create Authorised Users

  1. Scroll down to Create User
  2. Enter a Username and Password
  3. Click Save

You can create multiple users with different passwords.

Step 5 — Test the Protection

Visit the protected URL in your browser. You should see a browser authentication dialog asking for username and password.

Removing Password Protection

Return to Directory Privacy, click Edit on the protected folder, uncheck Password protect this directory, and save.

Use Cases

DirectoryUse Case
/stagingPreview site for client approval
/adminCustom admin panel
/reportsMonthly reports for internal team
/betaBeta version of new website
Tags:password protectiondirectory privacycPanelsecurity

Still need help?

Our Kenyan support team is on WhatsApp — real people, not bots. We respond in under 15 minutes.

WhatsApp Us
Braysons Host — Kenyan Hosting with WhatsApp Support