How to password protect a folder in cPanel

When such a folder is opened, the browser asks for a login and password. Use it for admin areas, staging copies and service pages.

  1. Open "Directory Privacy" (group "Files").
  2. Go into the site folder, for example public_html (click its name).
  3. Click "Edit" next to the folder you need.
Choosing the folder
Choosing the folder
  1. Check "Password protect this directory.".
  2. Enter a name - visitors see it in the login window.
  3. Click "Save".
Turning protection on
Turning protection on

Click "Back" and open the folder again. The "Create User" block appears.

  1. Enter a username and password.
  2. Click "Save".
User for the folder login
User for the folder login

The user appears under "Authorized Users". You can add several users.

Folder protected
Folder protected

Protection covers all subfolders. To remove it, clear "Password protect this directory." and save.

Questions and answers
Open the folder in "Directory Privacy", clear "Password protect this directory." and save.
Yes, the wp-admin folder. But admin-ajax.php ends up behind the password too, and some plugins stop working for visitors.