Sun

How to protect a directory with a password in cPanel?

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

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: https://billing.hostens.com/clientarea
  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 direcotory.

Once you enter the details for new user, press “Save” button under to create and new user, which will be authorized for this directory. Now, you can check any folder in “public_html” directory for example “http://gie.hamster.tips/giedrius”. You will be asked to enter 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