Using the cPanel Password Protect Directory option, we can restrict users from accessing certain parts of your web site. When a user try to access the restricted folder, it will prompt for a username and password. They need to supply the username and password which you set while protecting the folder.
How to Protect a folder using password ?
Fist login to your cPanel using the url http://yourdomain.extn/cpanel (use your own domain name instead of ‘yourdomain.extn’).
Click on ‘Directory Privacy‘ icon. This can be find under the main menu ‘FILES‘.
A prompt will come. Choose ‘Web Root‘ (and you may need to select Show Hidden Files) and click on ‘Go‘ button.
Click on the directory that you wish to password protect. Clicking a folder name will password protect that folder. If you want to password protect a subfolder, click on the folder icon next to folder name, then select your appropriate folder.
Check the box for “Password protect this directory.”
In the ‘Enter a name for the protected directory:’ text box, type a name for the protected directory. It is just the message that will show to your visitors when they try to login to the protected directory. So you can enter anything as you like.
Click ‘Save‘ button.
Now under Create User, type a username in the ‘Username‘ text box and type any password in the ‘New Password‘ and in the ‘Confirm Password‘ text box.
Once done, click ‘Save‘ button.
NOTE: You can add any number of users to a password-protected directory.
Now, when you visit the site in your web browser you’ll be prompted with a login screen for that directory.
How to Remove the password protection from a directory ?
Removing password protection on a directory is a quick and simple process. The instructions are as follows:
Log into your cPanel.
Click on the ‘Directory Privacy‘ icon.
A prompt will come. Choose ‘Web Root‘ (and you may need to select Show Hidden Files) and click on ‘Go’ button.
Click the name of the directory for which you want to remove password protection.
Uncheck the box that says “Password protect this directory“.
Click on ‘Save‘ in order to save your entries.