How to Password Protect Directories in cPanel

6 Views
Published
In this video we will show you how to password protect a directory within the cPanel.

Protecting the entire site is sometimes done if someone wants to hide the site from the public until they are finished building it.

Protecting specific subfolders is sometimes done for development purposes and others just to allow specific people to have access to that part of the site.

This is not meant to replace a membership style site, which is much more complex. This is just for access to a specific area. Think of it like a locked closet in the office where you keep things you don’t want everyone to access.

First, log into the cPanel dashboard.

Next, look for the correct category. Getting to the tool is a bit different depending on which theme you are using.

If you are using the older X3 theme, then you will want to find the “Security” category and then click on the “Password Protect Directories” icon.

If you are using the new “Paper Lantern” theme, then locate the “Files” category, which is the top one by default, and click the “Directory Privacy” icon.

In either case, a popup will appear asking you which folder level to enter the tool from.

For the x theme, select Web Root and then click on “Up One Level” to get to the home directory.

The “Paper Lantern” theme already has a “Home Directory” option, so go ahead and click that.

You are taken to the protection tool where you can select any folder you want to password protect.

Now you get to select the folder you want to protect.

If you want to protect your entire site, you want to password protect the entire public_html folder. Simply click on the folder name to go to the next screen.

If you want to have a specific subfolder protected, then enter the public_html folder and find the specific folder you want to protect by clicking on the folder image. This takes you to the list of folders underneath for you to choose from.

You are now on the Password screen.

First, select the checkbox that says “Password Protect This Directory”. You can use this to toggle the password protection after you finish setting up.

Next, give the directory a name. This will show in a popup when someone tries to access the area. You could make it say something like “Members Only” or “Private Area”, or anything else you like.

Now, you need to create at least one user to be able to access the zone. If it is a workgroup, perhaps you want to have a single username and password. This way you can change a single password to lock everyone out for security reasons. This is normal for project work.

If you have a handful of people you want to give access, such as a small privileged area, then you can assign a user to different people. You would need to go through this for each member, however.

Once you have created a user and strong password, click on the “Add or Modify the Authorized User” button.

This will add the new user to the list.

Now, when you attempt to access the site or that specific area, you will be met with the popup to enter a username and password.

If it fails, the visitor will get a 401 error page.

If it works, they will see whatever they are supposed to see.

For more information, see our full guide - How to Add Password Protection for a Directory Using cPanel -
https://www.inmotionhosting.com/support/website/protecting-files/how-do-i-password-protect-a-directory-in-my-control-panel-cpanel

InMotion Hosting was founded in 2001 and provides personal and business web hosting for everyone! For more information about InMotion Hosting and the services we provide see here:

https://www.inmotionhosting.com
Category
InMotion Hosting
Tags
cpanel, password protection
Be the first to comment