In this tutorial, we are going to show you how to Password Protect a directory using CPanel. CPanel makes this process very easy, with only four steps to complete. Once the directory is password protected, visitors to your website will only be able to access it or any directories beneath it by using a username and password combination that you create.

Password protecting a directory keeps it from showing up in a browser unless the visitor enters the right username and password. This is useful when you’ve made a part of your site that you don’t want everyone to see. For instance, if you’re working on a design for a client or you’re collaborating with a developer on a new section of your own site, you wouldn’t want everyone else to be able to see the unfinished work. Instead, you would put a password on that area so only the people who need to see it will be able to.

In this tutorial, we’re going to password protect the main directory of your website. This directory is called public_html, and applying a password here will lock every directory in your hosting space. If you only need to lock a specific directory, you can do so by choosing that directory in step 2.

Step 1: Selecting Password Protect Directories in CPanel


The first step to password protecting a directory is choosing the Password Protect Directories icon in CPanel, located under the Security section. Once you click it, you will choose the domain you want to work with. If you are using addon domains, you will have additional domains to choose from. If not, just hit the go button.

Step 2: Select the directory to password protect

Select the directory you would like to protect. To dig deeper into your directories, click the folder icon next to the parent directory. Do this until you find the directory you want to protect. Once you find the one you are looking for, click the name of it.

Step 3: Name your password protected directory


Once you’ve selected your directory, you are taken to the permissions page. Check the box that says “Password protect this directory”, enter a name for it and hit Save.

Step 4: Create a user to access the password protected directory


The last step is to create a user for this directory. Type a username into the Username field and a password into the Password field. If the password is not strong enough, CPanel will not accept it. You can use the Password Generator to have CPanel to create a password for you, but make sure to copy the password and put it in a safe place. When you are finished, hit the Add or Modify the Authorized User button.

Password Protected Directory Login Box
The username and password box will now appear for your password protected directory.

When each step is complete, your directory will be password protected. Since this is a recursive protection, every directory beneath will also be protected. For example, public_html will be protected, but so will public_html/images and public_html/clients.

When you’re ready to unlock the directory, take the checkmark out of the “Password protect this directory” box and hit Save.

That’s it! You’ve now learned how to quickly and easily password protect a directory using CPanel. For more tutorials on CPanel, WordPress, and other tools used by webmasters, visit us at and subscribe to our channel on Youtube.