LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

How to Add Two-Factor Authentication (2FA) to WordPress in About 2 Minutes

WordPress 2FAIt’s a dangerous world out there, and it’s extra-dangerous to run the world’s most popular CMS.  It’s exposed to the Internet 24×7 and you can bet hackers are looking for ways into your WordPress 24×7 as well.

There are some things you can do in order to lock down your site, such as using some kind of WAF (Web Application Firewall) to limit logins to your wp-login.php to certain IPs only.  This works very well, but doesn’t scale well if you have a team of content writers….particularly if they’re digital nomads whose IPs are always changing.  You can make them use VPNs, of course.  But every person you add with elevated privileges is another person who may get keylogged, reuse a password, or otherwise provide a compromise pathway.

One excellent (and somewhat simpler) way you can improve security is to require two factor authentication (2FA) for logins.  I recently set that up for LEB and thought I’d share how easy it is to get going.

If you know what you’re doing, the whole thing takes maybe 2 minutes.  Some of our more ‘leet members could probably get it done in under 60 seconds.

Install the Plugin

We’ll be using this popular plugin:

WordPress 2FA Plugin

It’s installed like any other plugin, but briefly:

  • In your dashboard, select Plugins->Add Plugin on the left menu bar
  • Search for “WP 2FA”
  • Click “Install Now” on the plugin shown above
  • Then click “Activate”

Enabling 2FA

Now you need to activate it on a user-by-user basis.  Go to the user in question and scroll down to this section:

WordPress 2FA Users

Click “Configure 2FA”.  The process for setting it up is pretty straightforward if you’ve ever setup 2FA for anything in the past.  There are two options:

WordPress 2FA Choice

I highly recommend selecting “One-time code via 2FA app” and not considering email.  Codes mailed to your email are sent in plain text (because that’s how email works).  Also, if your email is compromised, your WordPress is as well.  The world is moving away from SMS- and email-delivered 2FA codes and you should as well.

You’ll need some kind of authenticator app (e.g., Google Authenticator) on your phone or other device.  Then just follow the instructions.

And don’t forget backup codes!  You’ll be given the option to generate now or later.  I always generate immediately and store in a safe place.  For me, that’s a 1Password Secure Note, but anywhere that’s safe and encrypted is a good choice.  Getting locked out of your WordPress and having to muck around on the server to disable the plugin, etc. would be unpleasant so take a few seconds to prevent this headache.

Authentication

After that, 2FA just works.  After the normal WordPress login, you’ll see this:

WordPress 2FA Challenge

And it’s just that easy.  Stay safe!

 

 

No Comments

    Leave a Reply

    Some notes on commenting on LowEndBox:

    • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
    • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
    • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

    Your email address will not be published. Required fields are marked *