How to Password-Protect a Directory in cPanel
Restrict access to sensitive folders on your website using cPanel's built-in directory privacy feature.
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
- Log into cPanel
- 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
- Check Password protect this directory
- Enter a Label (e.g., "Admin Area — Authorised Users Only")
- Click Save
Step 4 — Create Authorised Users
- Scroll down to Create User
- Enter a Username and Password
- 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
| Directory | Use Case |
|---|---|
/staging | Preview site for client approval |
/admin | Custom admin panel |
/reports | Monthly reports for internal team |
/beta | Beta version of new website |
Still need help?
Our Kenyan support team is on WhatsApp — real people, not bots. We respond in under 15 minutes.