How can I limit access to certain directories on my server by requiring a password using cPanel/WHM?
Password protection is often used to protect a web directory if it contains data that should only be available to specified users. cPanel implements this control by using Apache’s .htaccess file. To set up a password for a folder:
- Log into cPanel for the account in question.
- Click Password Protect Directories in the Security section.
Note: For those using the “Paper Lantern” theme, replace step 2 with: Click Directory Privacy in the Files section.
- Select either the Web Root or Document Root directory and click Go.
- Select the folder you wish to password protect. You can also do this by going into File Manager and right-clicking on the appropriate folder.
- Follow the directions on the Password Protect Directory page to change the security settings for the folder and to create authorized users.
Photo by Marc Falardeau