How do I Password Protect a directory in cPanel?
At times, you may find it best practice to password protect a folder on your account. This can add an extra layer of protection to files you don’t want the general public to have access to. Password protecting a directory can be easily accomplished using the option within cPanel. We will also provide you the instructions on how to remove the password protection after it has been added.
Understanding how password protecting a directory works
It�s important to understand how password protection on a folder works. When you choose to password protect a directory in cPanel, cPanel creates a rule in your .htaccess file. This rule specifies that the folder is protected and the visitor will need to provide the proper username and password to log in and view the files.
Please keep in mind, when you grant access through password protection, you are not only granting access for that folder, but any subfolders located within it. Also, by password protecting a directory and gain access to any subfolders in that directory you must provide the login credentials to do so.
Steps to Password Protect a Directory
-
- Log into cPanel
- Go to the Files section and click on the Directory Privacy icon
-
- Select the directory you want to password protect and then you will see the Set Permissions screen appear. Here you can provide a name for the folder you’re trying to protect.
-
- Next, click on the checkbox labeled Password protect the directory. Makes sure you have a name for the folder you are going to protect.
-
- Click on Save in order to save the name you have entered for the directory and option to password protect the directory.
-
- Create a user to access the protected directory
- Click Save in order to save the user that you have edited.
Removing the password protection from a directory
The steps to remove password protection on a directory is a fairly quick and simple process. One reason you might want to password protect a directory and then remove the protection is for testing purposes. Or, if you are finally ready to make the folder open to the public, then you can remove the password protection so that everyone can access the files. The instructions for removing the protection are as follows:
- Log into your cPanel
- Scroll down to the Security section in the cPanel and then click the Password Protect Directories icon. Choose Web Root if you see a pop-up window, and then click Go
- Scroll down the folder list until you see the folder you previously password protected. If the folder is a sub-folder to another one, make sure that you click on the folder icon next to the folder name. If you click on the folder name, the interface will think you’re setting protection on that folder. If you do this by accident, simply re-open the password protection interface to get back to the folder list.
- When you find the folder that has been password protected, click on the folder name to select it.
- Uncheck the box that says “Password protect this directory“.
- Click on SAVE in order to save your entries.