To password protect a directory in cPanel, follow the below steps.
1. Login to your cPanel.
2. Under the security section, click on Password Protect Directories icon.
3. Select the directory you want to password protect.
4. Click Password protect this directory link.
5. Specify the details and click Save to complete.
6. Go back and specify Username & Password and click on "Add/modify authorized user".