How to Protect Directories with a Password in cPanel


In this tutorial we are going to discuss how to protect directories with a password using cPanel. Visit to your password protected directory must type username and password in order to see the contents of those directories.


How Password Protection works?


It is very crucial to understand how password protection actually works. When you opt to protect a directory with password using cPanel, cPanel then creates a rule in .htaccess file of your website. This rule states that the particular folder or directory is protected with a password and the visitor require to use the accurate username and password to see the files of that particular directory.


Steps to Protect a Directory with Password:

  • Login to cPanel.
  • Locate to the Files area and hit directory privacy.


  • Choose the directory you wish to protect with a password and once you click any option it will redirect you to Set Permissions window.



  • On this hit the check box labeled as Password protect the directory. Don’t forget to enter the name for the folder you are going to protect with a password.


  • Click save button to save the process you have completed above.
  • Now on this step you need to create a username and password to access the password protected directory.
  • Hi save button to save the user that you have created.



  • Now you have protected your directory using a password and when a user provide correct user name password can view the contents of your directory.

Removing password protection from a directory

 

You can also remove password from protected directory when you don’t wish to protect any directory with a password. In order to delete protection of a directory you don’t have to remove username and password that you created for protecting the directories. The username and password is reserved when you remove a password protection from your directory, it will just become inactive. If in future you want to re enable password protection for the directory, you can then use the same username and password.


Follow below instructions to remove password protection from a directory:

  • Login to cPanel account.
  • Go to the files area of cPanel, click Directory Privacy.
  • Then hit the directory name for which you are going to remove password protection.
  • Under the security settings, hit the checkbox labeled as clear the password protect this directory.
  • And then click save.

If you need more information, feel free to contact our support team.