How do I password-protect a directory in cPanel?

Procédure

What is directory password protection?

This interface allows you to protect specific directories in your web space. Once this feature has been activated for a directory, the user will be required to enter a username and password in order to connect to it.

  • This feature configures the ".htaccess" and "htpasswd" files to restrict access to files on your website.
  • This feature does not protect access via FTP, SFTP or Web Disk.

The ".htaccess" file contains the address of your ".htpasswd" file. The ".htpasswd" file contains a list of all your identifiers and their passwords.

The"Directory confidentiality" tab will allow you to create the various accesses without having to configure the two files manually.

How do I password-protect a directory in cPanel?

1. Log in to your cPanel account at & click on the"Directory Confidentiality" icon.

How do I password-protect a directory in cPanel?

2. Click on the directory you wish to protect

For this help article, we choose to protect the directory named "demo".

How do I password-protect a directory in cPanel?

3. Tick the "Password protect directory" box

Enter the name you wish to give to this protected directory, then click on the "Save" button

How do I password-protect a directory in cPanel?

The directory is now protected and requires a password to access it from the web.

We now need to create at least one user and assign a password to allow access to the directory.

4. Click on the "Back" button

How do I password-protect a directory in cPanel?

5. Enter the user name authorised to access the protected directory.

Enter a secure password: minimum 8 characters with at least one symbol (you can use the password generator to obtain a password automatically).

Click on the "Save" button

How do I password-protect a directory in cPanel?

It will be taken into account immediately:

How do I password-protect a directory in cPanel?

cPanel tutorial video: How do I password-protect a directory in cPanel?

Need help using cPanel?

See all our cPanel training videos

How do I manage directory protection in cPanel?

To view your active users, remove a protection, change a password, etc., follow these steps:

1. Connect to your cPanel account & click on the"Directory privacy" icon

How do I password-protect a directory in cPanel?

2. Click on the protected directory you wish to manage

How do I password-protect a directory in cPanel?

3. Scroll down the page.

You can then view the users authorised to access the protected directory, delete them & change their password.

How do I password-protect a directory in cPanel?


Conclusion

You can now protect one or more directories on your cPanel web hosting using the"Directory Confidentiality" function. You can protect one or more different directories.

Don't hesitate to share your comments or questions!

help.lws.net/a/669
Was this article helpful?

Yes

No

Read 24 062 times

Thank you! Feel free to ask questions about our documentation if you would like more information, and help us improve it.

Similar articles

A question about this article?

Ask the LWS team and the community. Answers are published after moderation.

Ask the LWS team and its community a question

GDPR: Controller: LWS-Ligne Web Services. Purpose: moderation and public publication of your question, possible notification of an answer. Legal basis: consent (Art. 6(1)(a) GDPR). Email retention: 90 days after notification, 12 months maximum without an answer. To exercise your rights, see the GDPR section of our Terms and Conditions.