How to Set Up Password-Protected Directories in cPanel (Secure Any Folder Easily)
Want to lock down a specific area of your website — like an admin folder, staging site, or download section? With cPanel, you can easily password-protect directories so only authorized users can access them.
In this guide, you’ll learn how to use cPanel’s built-in tool to secure any folder on your hosting account using a username and password.
✅ Why Password-Protect a Directory?
Password-protecting a folder allows you to:
- Restrict access to private areas of your website
- Secure development or staging environments
- Protect downloadable files from public view
- Limit admin access without third-party tools
It’s a quick way to add a second layer of security to sensitive content.
🚀 How to Set Up Password-Protected Directories in cPanel
Step 1: Log in to cPanel
Visit yourdomain.com:2083
or access your cPanel from your hosting dashboard.
Step 2: Open the Directory Privacy Tool
Under the Files section, click Directory Privacy (sometimes labeled as Password Protect Directories).
📁 Step 3: Choose the Directory to Protect
- Navigate through the folder list (starting from
/home/username/
) - Click on the edit icon next to the folder you want to protect (e.g.,
public_html/staging
)
💡 You can protect any folder inside your hosting account, not just website content.
🔐 Step 4: Enable Password Protection
- Check the box: “Password protect this directory”
- Enter a name for the protected area (e.g., “Private Area”)
- Click Save
Now, cPanel will require a username and password to access this folder in the browser.
👤 Step 5: Create an Authorized User
After enabling protection:
- Scroll down to the Create User section
- Enter a username and a strong password
- Click Save
Done! Now when someone tries to access the folder via browser (yourdomain.com/staging
), they’ll be prompted to enter the credentials.
🛠️ Managing Password-Protected Folders
You can:
- Add multiple users for shared access
- Update passwords anytime
- Remove password protection by unchecking the protection box
⚠️ Things to Note
- Password-protected folders only apply to HTTP/HTTPS browser access
- This does not secure folders from FTP or File Manager access
- Make sure your
.htaccess
file is writable — cPanel uses it to apply protection
Using cPanel’s Directory Privacy tool is a quick and powerful way to restrict access to sensitive folders. Whether you’re testing new features, storing client data, or hiding download files, password-protected directories give you control without extra plugins or coding.
Need help configuring your protected areas or troubleshooting login errors? Reach out to our support team — we’re always happy to assist.