Skip to main content

YubiKey

Chekc YubiKey by Yubico on online website.

Login with GDM

  • Install libraries

    apt install libpam-u2f
    
  • Create a global directory to save registered keys

    mkdir /etc/Yubico
    
  • Register username's YubiKey in /etc/Yubico/u2f_keys_username

    # On your YubiKey, touch the key when the light is flashing to verify the user presence.
    pamu2fcfg -u "$SUDO_USER" > /etc/Yubico/u2f_keys_username
    
    # For multiple YubiKey for same user.
    pamu2fcfg -u "$SUDO_USER" -n >> /etc/Yubico/u2f_keys_username
    
    # Content of /etc/Yubico/u2f_keys_username
    username:BASE64CODE:BASE64CODE,es256,+presence
    
  • Edit file /etc/pam.d/gdm-password

    @include common-auth
    
    # YubiKey is required
    auth    required        pam_u2f.so    authfile=/etc/Yubico/u2f_keys_username    cue
    
    # YubiKey is an optional
    option#   - if it succeeds, skip further auth
    #   - if it fails/absent, fall through to whatever comes after
    auth    [success=1 default=ignore]    pam_u2f.so    authfile=/etc/Yubico/u2f_keys_username    cue
    
    auth    optional        pam_gnome_keyring.so
    @include common-account
    
  • Test and Verify (Optional)

    sudo apt install pamtester
    
    pamtester gdm-password $USER authenticate