I want to lock the screen when the YubiKey is removed, but sys-usb is set as disposable

I would like to use the “Optional: Locking the screen when YubiKey / NitroKey3 is removed” section on this page, but I have set sys-usb as a disposable. In that case, should I perform the tasks under “In your USB VM:” in the default template?

1 Like

By “default template”, do you mean " the disposable template of sys-usb "?

1 Like

Yes.

1 Like

I dont use Yubikey but you’re right: to configure anything persistent, you need to use the disposable template.

1 Like

I wrote something about this Solene'% : How to trigger a command on Linux when disconnected from power

just figure the rule for “YubiKey is removed” and adapt the script to lock the screen in dom0

You can run a command in sys-usb this way, even if it’s disposable. In my setup, I query sys-net to check if I’m at home or not to figure if the system must shutdown.

if ! qvm-run -u user sys-net "nmcli device wifi list | grep my_wifi_network"
then
    systemctl poweroff
fi
3 Likes

Actually, buskill tutorial should fit a lot better [Guide] Disarm BusKill (Dead Man Switch) with Keyboard Shortcut

3 Likes

Is this my_wifi_network tethering the phone? This is very smart.

1 Like

It could be, but it’s my home’s wifi network as I often use my laptop around and it’s often disconnected, I don’t want it to poweroff here.

1 Like