How to Setup Multi-Factor Authentication for SSH on Ubuntu

Setting up MFA for SSH on the production server to fulfill CIS (Center for Internet Security) Compliance.

To protect your server from any type of unwanted cyber attack, It is important for us to setup MFA on ssh in production server.

It will help you secure your whole infrastructure even it is directly exposed to the world for admin access.

You can implement the same with any VPN service to.

So let’s begin,

Step 1

Login to your server and run the command,

Step 2

Run the below command with sudo,

Step 3

Edit the below file and change the configuration to,

Step 4

Run the below command,

Step 5

Now, you already have installed “google-authenticator” on your server, so run the below command,

Step 6

Follow the below Snapshot,

Great now our MFA is successfully installed and active, just scan the barcode with a google-authenticator app available on play store or use chrome “Authenticator” extension, and you’re done.

Open a new ssh session with your server, this time it will ask you an MFA code, copy the code from an app or extension and paste it on a terminal and now you will get authenticated.

Askops
Askops
Developer: Nikhil raj
Price: Free

Leave a Reply