Skip to content

Instantly share code, notes, and snippets.

View mdp's full-sized avatar

Mark Percival mdp

View GitHub Profile
@hazrac
hazrac / gist:4470427
Created January 6, 2013 21:38
# 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 Work to use google 2 factor auth for ssh, based on these two posts: http://w…
#!/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"]