How to protect a directory with a password in cPanel?

  1. Home
  2. Knowledge Base
  3. Hosting
  4. cPanel
  5. Web Hosting
  6. FTP
  7. How to protect a directory with a password in cPanel?

How to protect a directory with a password in cPanel?

Before you proceed to cPanel check out our web hosting plans →

In order to create a password protected directory in cPanel, follow the guideline:

First, you need to connect to your cPanel dashboard, which you can do by following steps:

  1. Log in to your account in our Clients Area:
  2. Choose your Web Hosting(cPanel) service;
  3. Press the button “Access Control Panel” on the left menu and then the button “Click here to access control panel“.

In the main menu, choose “Directory Privacy” under section “Files“, you will see the view below:

When you see the list of the directories on your server, choose a directory, in which you will protect with a password. Let’s say we want to protect the “public_html” directory. Choose “public_html” and the new settings will be displayed, like below:

The most important thing here is to check the box “Password protect this directory“. Also, enter the name (it will not be an actual server, only a label), which will be protected, for example “giedrius” and press “Save” button.

After that, you need a user, to have access to this new password-protected directory, you can do it in the same settings window. Simply fill the field:

  • Username – new user to access the directory;
  • New Password/Confirm Password – a password in order to access the directory.

Once you enter the details for a new user, press the “Save” button to create and new user, which will be authorized for this directory. Now, you can check any folder in the “public_html” directory for example “”. You will be asked to enter the username and password, you created to access the content.

Note. This feature does not protect directories that users access via FTP, SFTP, Web Disk, or other services, or when they access files locally.

You can create few separate users for the same directory, with different credentials.

Was this article helpful?

Related Articles