Security & Protection3 min readβ€’Updated September 2026β€’Reviewed 2026-09-27

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'.

See Also

How to Restrict Directory Access to Specific Whitelisted IPs

3 min read β€’ Read β†’

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)