Skip to content

Instantly share code, notes, and snippets.

@schneefisch
Last active September 14, 2020 08:59
Show Gist options
  • Save schneefisch/02ac1d1a7995da4bdc90fbb08c07a09d to your computer and use it in GitHub Desktop.
Save schneefisch/02ac1d1a7995da4bdc90fbb08c07a09d to your computer and use it in GitHub Desktop.
How to setup Yubikey login protection on Ubuntu
#!/bin/bash
# how to configure Ubuntu, see:
# https://support.yubico.com/support/solutions/articles/15000011355-ubuntu-linux-login-guide-challenge-response
# configure a yubikey
ykman otp chalresp -g 2
# associate a yubikey with your account
ykpamcfg -2
# ------------
# other way
sudo apt install libpam-u2f
mkdir ~/.config/Yubico
pamu2fcfg > ~/.config/Yubico/u2f_keys
# for additional keys run
pamu2fcfg -n >> ~/.config/Yubico/u2f_keys
# configure system to use U2F keys
sudo nano /etc/pam.d/sudo
# Add the line below after the “@include common-auth” line.
auth required pam_u2f.so
# configure system to use U2F keys for login
sudo nano /etc/pam.d/gdm-password
# Add the line below after the “@include common-auth” line.
auth required pam_u2f.so
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment