Two-Factor Authentication for SSH Login on Linux Logo

Two-Factor Authentication for SSH Login on Linux

This tutorial describes how to set up two-factor authentication for an SSH server by integrating Google Authenticator with OpenSSH.

Visit website
0

Two-Factor Authentication for SSH Login on Linux Description

This tutorial describes how to set up two-factor authentication for an SSH server by integrating Google Authenticator with OpenSSH. Install Google Authenticator on Linux The first step is to install Google Authenticator on your Linux host. You can do this by running the following command: sudo apt-get install google-authenticator Configure Google Authenticator Once installed, you can configure Google Authenticator by running the following command: google-authenticator You will be prompted to enter a secret key. Make a note of this key, as you will need it later. Configure OpenSSH To configure OpenSSH to use Google Authenticator, you need to create a new file in the /etc/pam.d directory. You can do this by running the following command: sudo nano /etc/pam.d/sshd Add the following lines to the end of the file: auth required pam_google_authenticator.so Save and close the file. Then, restart the SSH server by running the following command: sudo service ssh restart Use Google Authenticator To use Google Authenticator, you will need to generate a one-time passcode on your Android device. You can do this by opening the Google Authenticator app and scanning the QR code that was generated during the configuration process. Enter the one-time passcode on your Linux host, and you will be logged in to your SSH server. Summary: This tutorial describes how to set up two-factor authentication for an SSH server by integrating Google Authenticator with OpenSSH.

FEATURED

Proton Pass Logo

Password manager with end-to-end encryption and identity protection features

NordVPN Logo

VPN service providing encrypted internet connections and privacy protection

Mandos Fractional CISO Services Logo

Fractional CISO services for B2B companies to accelerate sales and compliance

Stay Updated with Mandos Brief

Get the latest cybersecurity updates in your inbox

POPULAR

RoboShadow Logo

A cybersecurity platform that offers vulnerability scanning, Windows Defender and 3rd party AV management, and MFA compliance reporting, among other features.

10
TestSavantAI Logo

Security platform that provides protection, monitoring and governance for enterprise generative AI applications and LLMs against various threats including prompt injection and data poisoning.

5
Cybersec Feeds Logo

A threat intelligence aggregation service that consolidates and summarizes security updates from multiple sources to provide comprehensive cybersecurity situational awareness.

5
Fabric Platform by BlackStork Logo

Fabric Platform is a cybersecurity reporting solution that automates and standardizes report generation, offering a private-cloud platform, open-source tools, and community-supported templates.

5
Mandos Brief Newsletter Logo

A weekly newsletter providing cybersecurity leadership insights, industry updates, and strategic guidance for security professionals advancing to management positions.

5
View Popular Tools →