This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'rotp' | |
# This is a script to use two factor authentication with public ssh keys (since you can't use PAM (g2fa) and public keys) | |
# You must refrence this script in your sshd config: ForceCommand="/usr/bin/two_factor_ssh" | |
# The script has to be executible by the user logging in | |
# get the username of the user logging in | |
user = ENV["USER"] |