Password-protect a folder (Directory Privacy)

Web Hosting & cPanel

0 people found this article helpful

With Directory Privacy in cPanel, visitors need a username and password to open a folder of your website – useful for a site that is still being built or for files only some people should see.

Video: Password-protect a folder (Directory Privacy)

Watch the video (1 min 44 s, with narration) – or follow the steps below.

Step 1: switch on the protection

  1. Log in to cPanel (see Log in to cPanel from the client area). In the section Files, click Directory Privacy. The list shows the folders of your account; the column Private shows whether a folder is protected.

    1. Click a folder name, for example public_html, to see the folders inside it.
    2. Click EDIT next to the folder you want to protect – here the folder of the subdomain shop.mallawebstudio.co.za.
    The Directory Privacy list of folders with the column Private and the EDIT buttons
  2. Under Security Settings:

    1. Tick Password protect this directory.
    2. Enter a name for the protected directory – visitors see this name in the password window, for example Shop under construction.
    3. Click Save.
    The Security Settings for the folder shop.mallawebstudio.co.za with the tick box, the name field and the Save button

Step 2: create a user

  1. After saving, click Go Back. On the same page, under Create User:

    1. Username – the name people type to open the folder, for example client.
    2. New Password and Confirm Password.
    3. Or click Password Generator for a strong password. The bar Password Strength shows how strong it is.
    4. Click Save.
    The section Create User with the fields Username, New Password and Confirm Password, the Password Generator and the Save button
  2. Give the username and password to the people who may see the folder. When they open the address, their browser asks for both.

These users only work for this folder. They are not FTP or cPanel users and can't change anything on your hosting.

Remove the protection

Open the folder again with EDIT, untick Password protect this directory. and click Save.

Good to know: protecting public_html itself locks your whole website, including all subfolders. Protect only the folder you need.

Related articles

Need help? Open a ticket or call us on 082 412 6556.


Was this answer helpful?

Powered by WHMCompleteSolution