How Can We Help?

How to protect a folder with username and password in cPanel?

You can lock a directory with a password by using the cPanel “Password Protected Directories” Option.

1. Log into your cPanel account.
2. In the “Files” section, click on the “Directory Privacy” Icon.
directory privacy cPanel-websiteroof

3. Click the icon to open a folder.
directory privacy cPanel-websiteroof

4. Click on the name of the directory you want to protect by password.
directory privacy cPanel-websiteroof

5. Under “Security Settings“, check the box next to “Password protect this directory” and enter a name for the protected directory like “Password Protected Area“. Then click the “Save” button.
directory privacy cPanel-websiteroof

6. Now click on the “Go back” button.
directory privacy cPanel-websiteroof

7. Scroll down the page and under “Create User” fill in the username and password fields or use the Password Generator option to generate a new random password and copy the user/password to a notepad. You will need this when you want to open your password-protected directory and click on the “Save” button.
directory privacy cPanel-websiteroof

Now, should you try to open your password-protected directory in your browser through the URL www.example.com/myfolder, which is already password protected, your browser will prompt you to enter your username and password.
directory privacy cPanel-websiteroof

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Previous How to Enable the Two-Factor Authentication on Your cPanel Account?
Next How to protect your .htaccess file?
Table of Contents
Customers' reviews on Hostings.info Website Roof is listed on whtop.com Website Planet IPV6 Supported Secured by Imunify360