Skip to content
Host4u Limited

Password-protecting a folder

Support Portal  »  Knowledgebase  »  Viewing Article
There was a problem loading the comments.
  Print

You can make visitors enter a username and password before they can see a folder on your website, for example while you build a site or for a members-only area.

Protecting a folder

  1. In cPanel, open Directory Privacy (in the Files section).
  2. Click the folder names to move around, and click Edit next to the folder you want to protect. The folder is called public_html for your main website.
  3. Tick Password protect this directory.
  4. Enter a name for the protected directory. Visitors see this name in the login box.
  5. Click Save, then Go Back.
  6. Under Create User, enter a username and a password (and type the password again, or use Password Generator), and click Save.

From then on, anyone opening that folder in a browser is asked for the username and password.

Adding and removing users

Open the folder in Directory Privacy again. Create more users in the same way. To remove one, choose them in the Authorized Users list and click Delete User. To remove protection from the folder, untick Password protect this directory and save.

If you cannot create a user, set the folder's permissions to 0700 in File Manager and try again: see File and folder permissions.

Things to know

  • Protecting public_html protects your whole website, including pages visitors need.
  • It protects the folder and everything inside it.
  • The password protects pages in a browser. It does not protect access by FTP, SFTP or Web Disk.
  • Do not use your cPanel password here. Use a separate one.

Share via
Did you find this article useful?  

Related Articles


Self-Hosted Help Desk Software by SupportPal