Ultra Web Hosting Docs

Password-Protecting a Directory

Directory Privacy lets you put a username-and-password gate in front of any folder on your site. Visitors must sign in before the browser will show anything inside. It's a quick way to lock down a staging area, an admin folder, or private downloads.

What Directory Privacy Does

When you protect a folder, the web server prompts every visitor for credentials before serving any file in it. Only the users you create can get through. Nothing inside the folder is exposed to search engines or the public until someone signs in.

Protecting a Folder

  1. Log into cPanel.
  2. Go to FilesDirectory Privacy.
  3. Browse to and click the folder you want to protect.
  4. Check Password protect this directory.
  5. Enter a label (for example, Staging Area). This text appears in the browser's login prompt.
  6. Click Save.

Creating an Authorized User

Protecting the folder is only half the job — you also need at least one login:

  1. On the same page, scroll to Create User.
  2. Enter a username and a strong password (use Generate for a random one).
  3. Click Save.
Warning If you enable protection but never create a user, no one — including you — will be able to open the folder. Always create at least one authorized user.

How It Works Behind the Scenes

Directory Privacy uses two small files that cPanel writes into the protected folder:

Together they trigger the standard browser login box (HTTP Basic authentication). You don't need to edit these files by hand; cPanel manages them for you.

Good Use Cases

Note Directory Privacy pairs well with Leech Protection, which stops a single shared or leaked password from being abused by a crowd of users. Turn both on for sensitive folders.

Removing Protection

  1. Return to FilesDirectory Privacy and select the folder.
  2. Uncheck Password protect this directory.
  3. Click Save.
Seeing a 403 instead of a login box? A leftover or misconfigured .htaccess can cause a Forbidden error. Our 403 Error guide explains how to track down and fix the cause.