Created
January 10, 2018 08:10
-
-
Save jmlemetayer/20e936a2ef4c7e10804a69fdacab9ca4 to your computer and use it in GitHub Desktop.
Using Yubikey U2F on Debian 9 for authentication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ACTION=="remove", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0407", RUN+="/usr/local/bin/gnome-lock" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for file in /tmp/.X11-unix/* | |
do | |
display=${file##*X} | |
user=$(/bin/ls -l --directory ${file} | cut -d " " -f 3) | |
uid=$(/usr/bin/id --user ${user}) | |
if test -f /run/user/${uid}/gdm/Xauthority | |
then | |
DISPLAY=:${display} su ${user} -c "/usr/bin/dbus-send \ | |
--type=method_call \ | |
--dest=org.gnome.ScreenSaver \ | |
/org/gnome/ScreenSaver \ | |
org.gnome.ScreenSaver.Lock" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using Yubikey U2F on Debian 9 for authentication
Prerequisites
Installation
U2F authentication
Reboot or logout to finish the setup.
Now, for every local authentication (console login, GUI login, sudo, desktop screen lock) you will need to used your Yubikey. Note that remote authentication (SSH logins) will not be impacted.
Lock screen when the Yubikey is unplugged
When logged in, just unplug your Yubikey to lock your screen.
Resources