cPanel Directory Privacy - Guide to password-protecting folders

What is cPanel Directory Privacy?

Directory Privacy in cPanel is a tool that lets you protect specific folders of your hosting account with a password. When a visitor tries to access a protected folder, a login window (username/password) appears.

This is particularly useful when:

  • You want to protect an admin folder or a temporary development environment.

  • You keep folders with sensitive files.

  • You want to restrict access to authorized people only.


Main features of Directory Privacy

1. Selecting the folder to protect

  • In cPanel, open Directory Privacy.

  • Browse the directory (e.g. public_html/test) and select the folder you want to protect.

2. Enabling password protection

  • Tick the Password protect this directory box.

  • Enter a name for the protected directory (it appears in the message the user sees).

3. Creating an access user

  • Create a new user with a username and password.

  • This user will be used to log in to the folder.

  • You can have multiple users for the same folder.

4. Deleting or changing access

  • From the same menu you can edit or remove users.

  • If you disable the protection option, the folder becomes public again. To also hide the file listing of a folder, see the guide cPanel Indexes.


Practical examples

  • Protecting a demo site: If you are developing a new website and do not want it to be visible to everyone, protect its folder with Directory Privacy.

  • Restricted access: Give access only to partners or clients who need specific files.

  • Security: If you have scripts or backups that should not be downloadable by just anyone, put them in a protected folder.


Frequently Asked Questions

How secure is Directory Privacy?

It is secure enough for basic folder protection. However, it does not replace stronger security measures such as SSL, 2FA or a firewall. For protection against shared passwords, see cPanel Leech Protection.

What happens if I forget the password?

Simply create a new user from Directory Privacy.

Can I protect the entire website?

Yes, just apply Directory Privacy to the folder public_html. However, this is not recommended for live sites that must be accessible to the public.


Conclusion

cPanel Directory Privacy is a simple but powerful tool that lets you restrict access to folders in your account. It is ideal for test sites, sensitive data and development environments, providing an extra layer of security.

Was this article helpful?

Related service Konet Web Hosting cPanel, LiteSpeed and automatic backups: 24 every 2 hours for 48 hours, then 6 daily, 4 weekly and 3 monthly.

Related articles