How to Use Directory Privacy in cPanel

How to Use Directory Privacy in cPanel

Learn how to protect specific folders on your website with a username and password using Directory Privacy in cPanel.

Directory Privacy in cPanel allows you to restrict access to a specific folder on your hosting account. When enabled, visitors must enter a valid username and password before they can open files inside that directory.

This feature is useful if you want to protect private content such as client files, internal documents, test pages, development folders, or any section of your website that should not be publicly accessible.

Important: Directory Privacy protects access to a folder by requiring login credentials. It is best used for folders that contain sensitive or restricted content. Be careful when enabling it on public website directories, as it may block normal visitors from accessing those pages.

What Is Directory Privacy in cPanel?

Directory Privacy is a built-in cPanel tool that lets you password-protect selected directories in your hosting account. Once enabled, anyone trying to access that folder through a web browser will be asked to log in first.

This protection applies only to the folder you choose and its contents. Subdirectories inside that folder are typically protected as well.

When Should You Use Directory Privacy?

  • To protect private downloads or documents.
  • To secure staging or development folders.
  • To limit access to internal project files.
  • To prevent public visitors from opening confidential content.
  • To add an extra layer of access control to selected website sections.

How to Access Directory Privacy in cPanel

  1. Log in to your Account.
  2. Open your hosting service details.
  3. Click Login to cPanel.
  4. In cPanel, go to the Files section.
  5. Click Directory Privacy.

How to Enable Directory Privacy

  1. Inside Directory Privacy, browse the folder list and locate the directory you want to protect.
  2. Click the folder name to open its privacy settings.
  3. Tick the checkbox labeled Password protect this directory.
  4. Enter a name for the protected directory. This label may appear in the login prompt.
  5. Click Save.
  6. cPanel will confirm that the directory protection has been enabled successfully.

How to Create a Username and Password

After enabling protection, you must create at least one authorized user who can access the protected folder.

  1. In the same Directory Privacy page, scroll down to the Create User section.
  2. Enter a username.
  3. Enter a strong password, or use the password generator if available.
  4. Confirm the password.
  5. Click Save or Create User.
Tip: Use a strong password that includes uppercase letters, lowercase letters, numbers, and symbols. Avoid using simple or repeated passwords.

How Directory Privacy Works

Once Directory Privacy is enabled and a user is created, anyone opening the protected folder in a browser will see a login prompt.

Only users who enter the correct username and password will be able to continue and view the contents of the folder.

How to Remove or Disable Directory Privacy

  1. Return to Directory Privacy in cPanel.
  2. Open the protected folder settings.
  3. Untick the checkbox for Password protect this directory.
  4. Click Save.
  5. You can also remove existing users if they no longer need access.
Note: If you protect the wrong folder, some parts of your website may become inaccessible to normal visitors until the protection is removed.

Best Practices for Using Directory Privacy

  • Protect only folders that need restricted access.
  • Use strong passwords and update them regularly.
  • Remove unused authorized users.
  • Avoid protecting the main public website folder unless necessary.
  • Test the protected directory after setup to confirm it works as expected.

Common Issues and Troubleshooting

Login prompt keeps appearing: Make sure you are entering the correct username and password.

Website pages became restricted: Check whether you enabled Directory Privacy on a public folder by mistake.

User cannot access the folder: Confirm that the user was created successfully and the password is correct.

Changes do not seem immediate: Clear your browser cache and test again in a private browsing window.

Need help protecting a folder in cPanel? Contact our support team through your Account and we will be happy to assist you.
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to Add a Subdomain to Your cPanel Hosting Account

How to Add a Subdomain to Your Hosting Account Create a subdomain in cPanel to organize...

How to Change the PHP Version via CloudLinux Selector in cPanel

How to Change the PHP Version via CloudLinux Selector in cPanel A complete guide to changing...

How to Use IP Blocker in cPanel

How to Use IP Blocker in cPanel...

How to Restore a Full Backup Using JetBackup in cPanel

Restore a Full cPanel Account Using JetBackup Learn how to restore your full cPanel account...

How to Use File Manager in cPanel

File Manager in cPanel Learn how to manage website files in cPanel File Manager, including...

Powered by WHMCompleteSolution

Profile
04:25
Profile
Hi there 👋

How can I help you?
Chat on Facebook