YubiKey lock screen: Difference between revisions
From D3xt3r01.tk
Jump to navigationJump to search
Created page with "==What== I'm trying to make my fedora desktop lock the screen and unlock when it sees my key in. ==HOW== Get the serial, idVendor, idProduct of the thing. <source lang="ba..." |
m →HOW |
||
Line 17: | Line 17: | ||
</source> | </source> | ||
And the 2 scripts | Also you should probably reload the rules: | ||
<source lang="bash"> | |||
udevadm control --reload-rules | |||
</source> | |||
And you should create the 2 scripts: | |||
<source lang="bash"> | <source lang="bash"> | ||
Line 32: | Line 37: | ||
~# cat /usr/local/bin/gnome-lock-disable | ~# cat /usr/local/bin/gnome-lock-disable | ||
#!/bin/bash | #!/bin/bash | ||
echo "lock | echo "lock disable" > /tmp/yubi_lock_log | ||
user=`ps aux | grep gnome-screensaver | head -n 1 | awk '{print $1}'` | user=`ps aux | grep gnome-screensaver | head -n 1 | awk '{print $1}'` |
Revision as of 19:15, 23 October 2012
What
I'm trying to make my fedora desktop lock the screen and unlock when it sees my key in.
HOW
Get the serial, idVendor, idProduct of the thing.
udevadm info -a -p $(udevadm info -q path -n /dev/hidraw0)
Create a /etc/udev/rules.d/85-screen-lock-toggle.rules
ACTION=="remove", ATTRS{serial}=="1234567890", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0010", RUN+="/usr/local/bin/gnome-lock-enable"
ACTION=="add", ATTRS{serial}=="1234567890", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0010", RUN+="/usr/local/bin/gnome-lock-disable"
Also you should probably reload the rules:
udevadm control --reload-rules
And you should create the 2 scripts:
~# cat /usr/local/bin/gnome-lock-enable
#!/bin/bash
echo "lock enable" > /tmp/yubi_lock_log
user=`ps aux | grep gnome-screensaver | head -n 1 | awk '{print $1}'`
if [ -n $user ]; then
GNOME_SCREENSAVER_PROC=`ps xa | grep gnome-screensaver | head -n 1 | awk '{print $1}'`
export `grep -z DBUS_SESSION_BUS_ADDRESS /proc/$GNOME_SCREENSAVER_PROC/environ`
su $user -c "gconftool-2 --set "/apps/gnome-screensaver/lock_enabled" --type bool 1"
fi
~# cat /usr/local/bin/gnome-lock-disable
#!/bin/bash
echo "lock disable" > /tmp/yubi_lock_log
user=`ps aux | grep gnome-screensaver | head -n 1 | awk '{print $1}'`
if [ -n $user ]; then
GNOME_SCREENSAVER_PROC=`ps xa | grep gnome-screensaver | head -n 1 | awk '{print $1}'`
export `grep -z DBUS_SESSION_BUS_ADDRESS /proc/$GNOME_SCREENSAVER_PROC/environ`
su $user -c "gconftool-2 --set "/apps/gnome-screensaver/lock_enabled" --type bool 0"
fi