Click here to watch a video tutorial

In this tutorial:

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

  1. Log into cPanel
  2. Find the icon under the Security heading and click on the Password Protect Directories icon
  3. pass_1

  4. Select the directory you'd like to navigate to in the pop up window.
  5. pass_2

  6. Now, select the directory 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 it's name, then select your appropriate folder.
  7. pass_3

  8. Once you have selected a folder to password protect a screen will appear with settings you'll need to configure. When finished save the settings and "new" user you create.
  9. pass_4

  10. Now, when you visit the site in your web browser you'll be prompted with a login screen for that directory.
  11. pass_6

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:

  1. Log into your cPanel
  2. 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
  3. 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.
  4. When you find the folder that has been password protected, click on the folder name to select it.
  5. Uncheck the box that says "Password protect this directory".
  6. Click on SAVE in order to save your entries.

If you have further questions or need further assistance please feel free to contact our support department.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Support Center Login

Social Media Login

Related Questions

Here are a few questions related to this article that our customers have asked:
Utilizing WordPress on the development site before going Live
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
n/a Points
2014-06-15 2:50 am

How long, if at all, for the changes to take affect and what causes the delays?

23,972 Points
2014-06-15 8:28 am
Hello Steve,

There should be no delays, it should take effect immediately. If you are not seeing it, be sure to clear your browser cache. That can sometimes be the cause of you not seeing the changes immediately.

Kindest Regards,
Scott M
n/a Points
2014-10-14 2:44 am

it shows like if the page does not exist, intead of asking for username and passwords

13,552 Points
2014-10-14 7:53 am
Hello joe,

Thank you for contacting us. I recommend checking the other rules in our .htaccess file, to make sure they are not interfering with the password protection.

We are happy to help, but will need some additional information.

Do other pages load?

Can you provide a link to the page that does not exist?

If you have any further questions, feel free to post them below.

Thank you,
n/a Points
2015-02-20 1:06 pm


I have another situation. I have an ftp. The ftp requires login. Inside the ftp there are folders. I want to give each folder password protection so a user can login to only the assigned folder. This would need to work with ftp clients and browser. Help is greatly appreciated!

2,033 Points
2015-02-20 3:05 pm
Hello Tom,

In order to do this you would need to create different logins for each folder you would like to protect. A FTP account only has access to its document root and any child folders beyond that.

Best Regards,
TJ Edens

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

6 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!