Anybody can access the content within the folder public_html (folder containing all public files of your hosting account) with a web browser. To limit or control access to particular directories within the public_html directory:
- Connect to cPanel
- Click on Web Protect in the Security section. You will find a list of sub-directories.
- Click on the icon to the left of public_html to see its content. This will show you the sub-directories of public_html.
- Click on the sub-directory name (not its icon) to modify its access requirements.
- In Security Settings, check the Password protect this directory box.
- Name the protected directory, such as 'My protected folder', for example.
- Click Save.
- At the bottom of the page, create a username and password to permit access to the protected folder.
- Click Add/modify authorized user
- You're all done! Check if the selected directory is correctly secured with the new settings by connecting to it with your web browser.
Note: You cannot password-protect individual files, only folders.