💾 Archived View for woffs.de › ~woffs › 2024-03-29-udev-yubi.gmi captured on 2024-06-16 at 12:13:17. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-05-10)

-=-=-=-=-=-=-

Lock Screen automatically when removing Yubikey from USB

Add an extra rule to udev which locks your session when you pull your Yubikey from its USB port.

In NixOS like this:

services.udev.extraRules = ''
  ACTION=="remove", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="1050/406/543", RUN+="${pkgs.writeScript "lock-screen" "#!/bin/sh\nexec ${pkgs.systemd}/bin/loginctl lock-sessions\n"}"
'';