How to Password Protect multiple WP-Admin folders

Kumar787

Registered
Aug 25, 2017
1
0
1
Internet
cPanel Access Level
Root Administrator
HI,

I have a dedicated server with 100+ WP sites and the server is under bruteforce attack since few days.

Is there anyway to password protect (directory privacy )Wp-admin folder for all sites via command line/ssh so that it can show a pop-up login before showing actual login page (example: [removed external URL]


i remember my old hosting company do this via command line.
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,917
2,248
363
Hello @Kumar787,

A single command isn't readily available, but you could develop a custom bash script that makes use of the following cPanel API 1 functions for all accounts:

cPanel API 1 Functions - Htaccess::set_protect - Developer Documentation - cPanel Documentation
cPanel API 1 Functions - Htaccess::set_pass - Developer Documentation - cPanel Documentation

The easier approach is likely to setup global protection against these types of brute force attacks. The information in the following thread is helpful:

wp-login.php and mod security

You may also find this WordPress document helpful:

Brute Force Attacks « WordPress Codex

Thank you.