Protect a Directory in cPanel

This article shows how to protect a directory in cPanel. The directories can be protected with the passwords to access those directories so that the visitors must enter the username and password to view the protected directories in cPanel. If a directory is protected by this, then if somebody from the front end of your website tries to access the file, they will be prompted to provide a username and password, if the username of the password does not match, then the user will not be able to see the content of that directory. To protect a directory in cPanel, follow the below steps

Step 1: Login to cPanel

Step 2: Select the option ‘Directory Privacy’ under the section Files

Step 3: Select the directory which needs to be protected

Step 4: Select the option ‘Password protect this directory’ and enter the name to protect the directory

Step 5: A successful message will be displayed for setting the access permission

Step 6: Create a user with username and password to provide access to use the protected directory

Step 7: Done, now the directory is protected with the password

Step 1 Login to cPanel.
Step 2 Go to Files section then click Directory privacy.

Go to file section then click directory privacy

Step 3 Select the directory you need to protect.
Select a directory to protect

Select a directory to protect.

Step 4 Now select the password to protect for the directory and also enter a name for protected directory and click save.
Enter the name of the directory and click save

Enter the name of the directory and click save.

Step 5 It will display the successful message.
Then the success image will be displayed.

Then the success message will be displayed.

Step 6 Then create a user to access the password protected directory and click save.
Create a user to access protected directory and click save

Create a user to access protected directory and click save

Step 7 Now the password is set successfully for the user.
Now the password is set for the user

Now the password is set for the user