How to Create A Password Protected Directory in cPanel

Within your website’s directories, you may have some files or information stored that you don’t wish all users to access freely, but you still want to keep it stored there for practical use. This may simply be the inner workings of your website, or it could be sensitive data. Fortunately, if you use a free hosting provider that offers cPanel as a platform for hosting and configuring your site, this won’t be a problem.

Cpanel directory password

The appropriate solution here is to set up a specific password-protected area to store the information. This will require a username and password before access to the secure directory is granted. A simple dialog can be displayed promoting a user for valid login details when they navigate to it.


In order to set this up, follow these steps:


1) Log in to your cPanel account through your usual route to access your main control panel.


2) From here, go to “Preferences” and choose the “Password Protect Directories” or “Directory Privacy” icon.


3) Input the directory details in the pop up dialog box. These will include the paths for your directory in the root folder and for your domain.


4) Select whether you want to show hidden files to users, which you would not normally need to enable unless you have a specific reason.


5) Click “Go” to be taken to the next stage.


6) Select your top level folder and sub-directory, navigating to the folder you want to password-protect.


7) Proceed and find the “Security Settings”, then tick the box for “Password protect this directory”.


8) Provide a name for the protected directory, which will be visible to anyone who attempts to access it when the dialog box asking for login details appears.


9) Click “Save” and then “Go back”.


10) Find a section named “Create User” and complete the fields for “Username” and “Password” before confirming the password, preferably using a “Very Strong” one.


11) Select “Add/modify authorized user” to confirm the user details you just created.


12) Add new users via the same method if you need multiple people to access your directory, or remove users as required.

Leave a Reply

Your email address will not be published. Required fields are marked *