Author: Malte Bublitz
Language/File type: Plain text
Description
A udev(7) rule which locks your screen using loginctl(1) when you unplug your YubiKey.
Code
1
2
3
4
5
6
7
8
9
10
11
#
# /etc/udev/rules.d/yubikey.rules
# udev Rules for my YubiKey
#
#
# Get udev attributes of the YubiKey for use in the rules:
#
# udevadm info --attribute-walk --name=$(realpath /dev/input/by-id/usb-Yubico_YubiKey_*-event-kbd)
#
ACTION=="remove", ATTRS{id/vendor}=="1050", RUN+="/usr/bin/loginctl lock-sessions"