Yubikey, Suspend and Restore
by Emile `iMil' Heitor - 2020-04-25
Another one of those quickies that can save you some time. When my Linux laptop resumed from sleep, I was annoyed that DrDuh’s perfect Yubikey setup would throw me the following when I tried to SSH:
sign_and_send_pubkey: signing failed: agent refused operation
Seems like the key doesn’t like being put to sleep and woken up. Another annoyance, for some reason, also when waking up, laptop’s touchpad was disabled.
So I put this little script in /lib/systemd/system-sleep
:
#!/bin/sh
devpath=$(grep -l 1050 /sys/bus/usb/devices/*/idVendor) # 1050 is yubikey's vendor id
kpath=$(dirname $devpath)/authorized
if [ "${1}" = "pre" ]; then
echo 0 >$kpath
fi
if [ "${1}" = "post" ]; then
echo 1 >$kpath
synclient TouchpadOff=0 # don't turn off my touchpad
fi
Greetings to ssokolow for the tip which I found searching for “reset usb command line”.