By using this way you can restrict the access to a directory but before you implement protection of particular folder, make sure you have created the directory or it exits in the directory section. To restrict access to particular directory (folder) via cPanel, understand and follow few simple steps.
Login to your cPanel
Reach “Password protect Directories” within the “Security” category of your cPanel
Select the web root from the prompt box which asks the location of the directory. For most of the user default option will work, and sometimes you need to select “Show Hidden Files”
Then go ahead and select the folder you want to password protect by clicking on its name
Check the box “Password Protect This Directory” and fill “Name the Protected Directory” (The message will be shown to the user while trying to login)
Click “Save” to update the protection level
Click “Back” and provide authorization information to provide access to particular user
Create user provide “Username” and “Password”
Click “Add/Modify authorized user” to save the authorization information of newly created user