Skip to main content

How to password protect a folder in cPanel

How to password protect a folder (directory) on your website using Folder Protection in cPanel.

Password protection of folders allows you to restrict access to specific parts of the site. This is useful for test environments, admin areas or content that should not be publicly available.

Overview

Folder protection in cPanel is used to protect folders with usernames and passwords.

This feature has several advantages. You can:

  • Limit access to specific folders on the site

  • Require username and password for access

  • Protect test and development environments

  • Easily activate it directly in cPanel

When you have finished this guide, you will know how to enable password protection for a folder and create a user with proper access.


Important information

Password protection applies only to web access to the folder (HTTP/HTTPS). It does not affect FTP access or file access via cPanel File Manager.

⚠️ Important: If you protect a folder used by a website or application, it may cause the page to stop working before the correct username and password are configured.


Prerequisites

Before you start, make sure:

  • You have access to cPanel

  • You have access to Folder Protection

  • You know which folder you want to protect


Step 1: Log in to cPanel

If your hosting service supports cPanel, you can log in directly from the dashboard in the client area.

This is how you do it:

  • Find your hosting service under the list of active products/services

  • Click on the button "Log in to cPanel"

  • You are now automatically logged into cPanel without having to enter your username or password again


Step 2: Open Folder Protection

Go to the Files section in cPanel and click on Directory Privacy.

You will now see an overview of the file structure in your hosting account.


Step 3: Select the folder you want to protect

Navigate to the folder you want to password protect.

Click on Edit to open the folder protection settings.


Step 4: Enable password protection

  1. Check the Password protect this directory checkbox.

  2. Type in a name of the protected folder (optional, used as a display name).

  3. Click on Save to activate the protection.

Once this is done, access to the folder will require username and password.


Step 5: Create a user for access

After the folder is protected, you need to create a user who can access it.

In the Create User section, enter:

4. Username
5. Password (and confirmation)

6. Click on Save

💡 Tip: Use a strong password to ensure that only authorized people can access the folder. You can click on the Password Generator to generate a secure password.

The folder is now protected, and only user with the correct username and password can access it.


Summary

You have now learned how to password protect a folder in cPanel using Folder Protection.

This feature gives you easy control over who has access to specific parts of your website, and increases the security of sensitive or unfinished content.

Did this answer your question?