How to protect a folder with username and password

Á

Álvaro Moura

Last updated on Jul 9, 2026

You can password lock a directory using cPanel's "Directory Privacy" option.

1. Log in to your cPanel account, see how to access cPanel at: https://help.scriptcase.net/portal/en/kb/articles/first-steps-with-the-hosting-access

2. In the "Files" section, click the "Directory Privacy" icon.

3**.** On the right side of the screen, click the "Settings" button.


When a small window prompts you, choose "Document Root for", select the domain where the

folder is located and click the "Save Changes" button.

4. Under "Security Settings" check the box next to "Password protect this directory" and enter a name for the protected directory, such as "Password protected area". Then click on the "Save" button.

5. Scroll down the page and under "Create User", fill in the username and password fields or use the Password Generator option to generate a new random password and click "Save".


Now if you try to open your password protected directory in your browser via the URL

which is already password protected, your browser will prompt you to enter the username and password.