Skip to content

Instantly share code, notes, and snippets.

View esavier's full-sized avatar
🦀

Mateusz Matejuk esavier

🦀
View GitHub Profile
@esavier
esavier / gist:ef82c96aff79d64a2851a1f4db884744
Created October 31, 2019 11:37 — forked from andrewlkho/gist:e9a8c996c4bc1df23cd2
How to secure debian with two factor authentication (TOTP/HOTP)

First, install the necesssary packages:

% apt-get install libpam-oath oathtool

Generate a key and write it to /etc/users.oath (NB the key will be in hexadecimal; if you are using Authy you will want to convert it to BASE32):

% KEY=$( head -c 1024 /dev/urandom | openssl sha1 | awk '{ print $2 }' )
% echo "HOTP/T30/6 andrewlkho - ${KEY}" >> /etc/security/users.oath
% chmod 600 /etc/users.oath