# Password-protect a directory
Source: https://docs.webgee.com/en/hosting/directory-privacy





**Directory Privacy** puts a username and password in front of a folder. Visitors
are prompted by the browser before they see anything inside. Applies to shared,
reseller and Premium hosting on cPanel.

Useful for a staging area, a client preview, or an admin folder that should not
be public.

## Protect a folder [#protect-a-folder]

<img alt="The Directory Privacy folder browser" src="__img0" />

1. In cPanel, open **Directory Privacy** in the **Files** section.
2. Navigate to the folder. Select a folder's **name** to move into it; select
   **Edit** to choose it.
3. Tick **Password protect this directory** and give it a name.
4. Save.
5. Create a user: enter a username and password under **Create User**, then
   **Add/modify authorized user**.

The protected folder shows **Yes** in the **Private** column.

<Callout type="warn">
  Setting a directory to private without creating a user locks out everyone,
  including you. The two steps are separate and it is easy to do the first and
  forget the second.
</Callout>

## What it does not protect [#what-it-does-not-protect]

This is HTTP authentication. It controls **web access to that folder only**.

* **It does not protect the files themselves.** FTP, SFTP and File Manager
  reach them normally.
* **It does not secure a WordPress site.** Protecting `wp-admin` breaks
  `admin-ajax.php`, which the front end uses — the usual symptom is features
  silently failing for logged-out visitors.
* **It is not encryption.** Credentials are sent with each request; they are
  only protected because the connection is HTTPS. Make sure
  [HTTPS is enforced](/en/security-ssl/force-https).

## Removing it [#removing-it]

Return to the folder, untick **Password protect this directory**, and save.
Delete the users too — they persist otherwise and reappear if you protect the
folder again later.

## Related [#related]

* [Force HTTPS on your site](/en/security-ssl/force-https)
* [Create and manage teams on cPanel](/en/hosting/how-to-create-and-manage-teams-on-cpanel)
