Two-Factor Authentication for SSH Login on Linux Logo

Two-Factor Authentication for SSH Login on Linux

0
Free
Updated 11 March 2025
Visit Website

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.

FEATURES

EXPLORE BY TAGS

SIMILAR TOOLS

International cybersecurity festival for all, who wants to dive into the world of cyber security and have a great time.

A tool to dump a Git repository from a website

A Python library for querying ThreatCrowd's API for email, IP, domain, and antivirus reports

An easy-to-use and lightweight API wrapper for Censys APIs with support for Python 3.8+.

Community project for developing common guidelines and best practices for secure configurations.

A set of instructions for the Dalvik virtual machine to manipulate registers and values in Android applications.

Comprehensive guide on best practices for PHP development.

Zero Online Banking offers a convenient way to manage money with various features like checking account activity and transferring funds securely.

Collection of CTF writeups from September 2018 onwards, including various CTFs and HackTheBox.

CyberSecTools logoCyberSecTools

Explore the largest curated directory of cybersecurity tools and resources to enhance your security practices. Find the right solution for your domain.

Operated by:

Mandos Cyber • KVK: 97994448

Netherlands • contact@mandos.io

Copyright © 2025 - All rights reserved