Security & Protection3 min read•Updated September 2026

How to Protect a Directory with Username & Password in cPanel

Directory Privacy restricts web access to specific folders (such as /staging/, /admin/, or /private/) by requiring a valid username and password.

Step-by-Step Instructions

1

Navigate to Directory Privacy in cPanel

In cPanel under 'Files', select 'Directory Privacy'.

2

Locate Your Target Directory

Navigate through public_html and click the name of the folder you want to protect.

3

Enable Password Protection

Check 'Password protect this directory', enter a display label (e.g., 'Restricted Area'), and click 'Save'.

4

Create Authorized Users

Under 'Create User', enter a Username and secure Password, then click 'Save'.

Related Guides in Security & Protection

How to Protect Your .htaccess File and Block Unauthorized Access

3 min read • Read →

How to Ban Malicious IP Addresses via .htaccess on LiteSpeed

2 min read • Read →

How to Blacklist an IP Address Using cPanel IP Blocker

2 min read • Read →
Chat with HubforHost on WhatsApp (+91 7780204727)