/hardware-auth-keys:pam-loginfrom hardware-auth-keys
Set up a hardware key (YubiKey, Thetis) for sudo, login and lock screen on Ubuntu via pam_u2f. Use on "touch to sudo", "yubikey login", "security key 2FA".
Ships in hardware-auth-keys. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
PAM changes can lock the user out of sudo and login. Before editing anything in
/etc/pam.d/:
sudo -i) and keep it open until
the change is verified;sudo cp /etc/pam.d/sudo /etc/pam.d/sudo.bak;Run detect; continue only when fido2-token -L lists the key.
sudo apt install -y libpam-u2f
mkdir -p ~/.config/Yubico
pamu2fcfg > ~/.config/Yubico/u2f_keys # touch the key when it blinks
pamu2fcfg -n >> ~/.config/Yubico/u2f_keys # backup key: appends, run with the 2nd key inserted
Register a second key (or keep password fallback) — a single lost key otherwise
means no sudo. For a system-wide mapping file instead of per-user, write to
/etc/u2f_mappings and add authfile=/etc/u2f_mappings to the PAM lines.
Choose the mode with the user:
| Mode | PAM line | Effect |
|---|---|---|
| Key or password | auth sufficient pam_u2f.so cue | touch the key instead of typing a password |
| Key and password (2FA) | auth required pam_u2f.so cue | password plus touch |
Put the line above @include common-auth in the target file:
| Target | File |
|---|---|
| sudo | /etc/pam.d/sudo |
| GNOME login screen | /etc/pam.d/gdm-password |
| KDE login (SDDM) | /etc/pam.d/sddm |
| lock screen | GNOME uses gdm-password; KDE uses /etc/pam.d/kde |
| everything (incl. TTY, su) | /etc/pam.d/common-auth — only once the per-service setup has been proven |
sudo sed -i '0,/^@include common-auth/s//auth sufficient pam_u2f.so cue\n@include common-auth/' /etc/pam.d/sudo
cue prints "Please touch the device." Add nouserok while rolling out to several
users so those without a registered key can still use their password.
sudo -k; sudo true # should ask for a touch (sufficient mode) or password+touch (required)
Then test once with the key removed: in sufficient mode the password must still
work; in required mode it must fail. If anything is wrong, restore from the root
shell: cp /etc/pam.d/sudo.bak /etc/pam.d/sudo.
Remove the pam_u2f.so line(s) from the edited files (or restore the .bak), and
optionally sudo apt remove libpam-u2f.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
15 skills in this plugin
/1password-credentialsMove PIV certificates, static passwords, PINs and inventory between 1Password and a YubiKey with op and ykman; passkey limits./1password-gpg-keysBack up GPG keys to 1Password and load them from 1Password onto a YubiKey OpenPGP card, with op, gpg and keytocard./1password-ssh-keysCopy SSH keys from 1Password to a YubiKey PIV slot, or save YubiKey SSH public keys to 1Password, with op and ykman./1password-totpCopy TOTP / 2FA secrets from 1Password to a YubiKey with op and ykman, or enrol to both. Use on "1Password TOTP to YubiKey"./browser-webauthnFix a missing security key (YubiKey, Thetis), passkey or WebAuthn prompt in Chrome, Chromium, Firefox or Brave on Linux. Use on "Chrome isn't asking for my key"./complementary-pluginsList and install plugins that complement hardware-auth-keys: ubuntu-security. Use on "what goes with this plugin", "related plugins".hardware-auth-keys@danielrosehill is listed by danielrosehill/claude-code-plugins — review the source before installing
npx claudepluginhub danielrosehill/claude-code-plugins --plugin hardware-auth-keys