How to password protect a directory in cPanel?

There can be times where you want to password protect certain folders. By doing so you can add an extra layer of protection to files you don’t want the general public to have access to. Adding passwords to directories can be done quite easily with cPanel’s Password Protect Directories. When you password protect a directory, cPanel will create a rule in your .htaccess file. This rule specifies that the folder is protected and the visitor will need to provide the proper log in credentials to view the files.

This tutorial will guide you on this topic in detail with images of each step. Watch the video tutorial about this setup on Familiarizing with cPanel – How to password protect a directory in cPanel?

  1.  Log into cPanel
  2. Find the Password Protect Directories icon under the Security heading and click on it.password-protect-directories-cpanel-icon
  3. Select the directory you’d like to navigate to in the pop up window. Click GO.password-protect-directories-directory-selection
  4. Now, select the directory you wish to password protect. Click a folder name and it will be password protected. If you want to password protect a sub folder, click on the folder icon next to it’s name, then select your sub folder.password-protect-directories-interface1
  5. Once you have selected a folder to password protect a screen will appear with settings you’ll need to configure. Check the Password protect this directory box. Give the directory a name and click Save.password-protect-this-directory
  6. The directory is now protected, and requires a password to enter it via a browser. We must therefore create at least one user, and assign them a password to access the directory so click Go Back.allow-access-to-only-authorized-users-interface
  7. Enter a username here.new-username
  8. Then enter and confirm a password.enter-confirm-password
  9.  Click Add authorized user.add-authorized-user
  10. The protected directory now has one user who has access to it. Repeat this process for each additional user you want to grant access for. You can see the active user for this directory here, and can add or delete users from this page at any time.active-user-screen

How to password protect a directory in cPanel?

This is the end of the tutorial. You now know how to password protect directories, and assign users to them. Checkout other tools under the Security category in cPanel to learn about each of it in detail.