Skip to content

Instantly share code, notes, and snippets.


Troy Fontaine troyfontaine

View GitHub Profile
troyfontaine /
Last active Apr 13, 2019
Getting Google Authenticator working on Ubuntu for SSH Authentication

Google Authenticator for SSH How-To

Installing the Google Authenticator pam package alone does not configure a system for 2 Factor Authentication when connecting via SSH.


The Google Authenticator package can be installed on Ubuntu via apt-get on Ubuntu 14.04.3 and later (that I've confirmed).

It provides a pam module that allows you to prompt a user for a code generated via a Google Authenticator app or other compatible TOTP app (such as 1Password). The script below enables the authenticator prompt when using ssh and password authentication.

A few things to keep in mind:

  • You cannot enable Google Authenticator for Public Key-based authentication at the same time as Password-based authentication
troyfontaine /
Last active May 11, 2020
Steps to join an Ubuntu 14.04 Server to Active Directory using realmd

Steps to join an Ubuntu 14.04 Server to Active Directory using realmd

Step 1: Perform updates

apt-get update

Step 2: Install realmd

apt-get install -y realmd
troyfontaine /
Last active Jan 2, 2018
Troubleshooting Ethernet Adapters on Ubuntu

Troubleshooting Ethernet on Ubuntu

Here are some commands to help troubleshoot network card issues on Ubuntu:

Find Connection State

Determine Speed and Duplex

dmesg |grep eth0
troyfontaine / cloud-config.yml
Created Jan 25, 2016
Multi-format Cloud Config File
View cloud-config.yml
Content-Type: multipart/mixed; boundary="===============0035287898381899620=="
MIME-Version: 1.0
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
troyfontaine / myserver.xml
Created Jan 25, 2016
KVM Virtual Machine Template XML
View myserver.xml
<domain type='kvm'>
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>4</vcpu>
<type arch='x86_64' machine='pc-i440fx-wily'>hvm</type>
<boot dev='hd'/>

Troubleshooting HAProxy

Step 1: Verify that HAProxy is running

On ubuntu, run the following command:

sudo service haproxy status

You should see output like below if it is running:

haproxy is running.
troyfontaine /
Last active Feb 5, 2016
Packaging Consul into a deb file
# Install pre-requisites
apt-get install software-properties-common
# Add PPAs
apt-add-repository ppa:brightbox/ruby-ng -y
apt-add-repository ppa:ansible/ansible -y
# Run update
troyfontaine /
Created Jul 12, 2016
MySQL RDS Cheat Sheet

MySQL RDS Cheat Sheet

1. Install the Command Line Client

On Ubuntu

sudo apt-get install mysql-client

2. Use the command-line client to connect

The below command will connect to the rds server specified after -h and open a MySQL client connection that you can run commands against.

# !/bin/bash
# Script to use Fleetctl to stop and start containers using a rolling restart
# By Troy Fontaine with rolling restart script from
# Grab list of containers and assign to array
container_list=($(fleetctl list-units -fields=unit -no-legend | cut -f2 ))
# Prepare variable for later use
troyfontaine /
Last active Oct 16, 2016
Install Ruby on Hypriot OS

Steps to install

  1. Install pre-requisite packages

    sudo apt update
    sudo apt install -y gcc make ruby-build
  2. Install rbenv

You can’t perform that action at this time.