Skip to content

Instantly share code, notes, and snippets.

@ju916
Last active January 29, 2021 17:11
Show Gist options
  • Save ju916/8f1267b43edfbd7be5127eb24045546f to your computer and use it in GitHub Desktop.
Save ju916/8f1267b43edfbd7be5127eb24045546f to your computer and use it in GitHub Desktop.
Udev Yubikey rules
# handcrafted file to trigger events on
# removal/insertion of Yubico U2F-Tokens
# place in /etc/udev/rules.d
# Key inserted
ACTION=="add", SUBSYSTEM=="hid", ENV{HID_NAME}=="Yubico Security Key by Yubico", RUN+="/usr/local/bin/device_inserted.sh"
# Key removed
ACTION=="remove", SUBSYSTEM=="hid", ENV{HID_NAME}=="Yubico Security Key by Yubico", RUN+="/usr/local/bin/device_removed.sh"
@borg1622
Copy link

Eine Alternative zum Matching auf HID_NAME könnte noch ein partielles Matching auf HID_ID mit der VendorId 1050 darstellen:
ACTION=="remove", SUBSYSTEM=="hid", ENV{HID_ID}="*:00001050:*", RUN+="/usr/local/bin/device_removed.sh"

Das funktioniert mit meinen Yubikeys und sollte auch mit dem U2F-Key so gehen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment