Skip to content

Instantly share code, notes, and snippets.

@lichti
Created February 6, 2019 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lichti/a245b9a1113ea826bf5b073df4f79e7d to your computer and use it in GitHub Desktop.
Save lichti/a245b9a1113ea826bf5b073df4f79e7d to your computer and use it in GitHub Desktop.
Script to configure yubikey as a 2FA in linux login
# Script to configure yubikey as a 2FA in linux login
# Distro Ubuntu 18.04
# Install pam module
sudo apt install libpam-u2f
# Register device for user
pamu2fcfg -u<user> | sudo tee -a /etc/u2f_mappings
# Cofigure yubike as required to login
sudo sed -i '/# here/a auth required pam_u2f.so authfile=/etc/u2f_mappings cue' /etc/pam.d/common-auth
# Cofigure yubike as sufficient to sudo
sudo sed -i 's/.*common-auth.*/auth sufficient pam_u2f.so authfile=\/etc\/u2f_mappings cue\n&/' /etc/pam.d/sudo
#sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment