1
1
Automatic Screen Lock at Removal
2
2
================================
3
3
4
- .. product-table :: all
4
+ .. product-table :: nk3 hsm pro storage
5
5
6
6
.. contents :: :local:
7
7
@@ -15,8 +15,6 @@ Requirements
15
15
- Ubuntu 20.04 or Debian 10 (Buster), both with `Gnome Display
16
16
Manager <https://wiki.gnome.org/Projects/GDM> `__ installed.
17
17
18
- - Nitrokey Pro 2, Nitrokey Storage 2, or Nitrokey HSM 2
19
-
20
18
Configuration
21
19
~~~~~~~~~~~~~
22
20
@@ -33,14 +31,15 @@ Add the following line to the file
33
31
34
32
.. code-block :: bash
35
33
36
- ACTION==" remove" , ENV{PRODUCT}==" 20a0/4108/101" RUN+=" /usr/local/bin/gnome-screensaver-lock"
34
+ ACTION==" remove" , ENV{PRODUCT}==" 20a0/4108/101" RUN+=" /bin/bash -c '/ usr/local/bin/gnome-screensaver-lock' "
37
35
38
36
Save the file and quit the editor.
39
37
40
38
This file sets up a new hardware rule that executes the ``gnome-screensaver-lock `` at removal of the Nitrokey device.
41
39
42
40
You should change the configuration according to the device you are using as following:
43
41
42
+ - Nitrokey 3: ``ENV{PRODUCT}=="20a0/42b2/107" ``
44
43
- Nitrokey Pro: ``ENV{PRODUCT}=="20a0/4108/101" ``
45
44
- Nitrokey HSM: ``ENV{PRODUCT}=="20a0/4230/101" ``
46
45
- Nitrokey Storage: ``ENV{PRODUCT}=="20a0/4109/101" ``
@@ -64,10 +63,10 @@ Add the following text
64
63
65
64
.. code-block :: bash
66
65
67
- user=` ps axo user:30,comm | egrep " gdm-(wayland|x)" | awk ' {print $1}' `
66
+ user=` ps axo user:30,comm | grep -E " gdm-(wayland|x)" | awk ' {print $1}' `
68
67
69
68
if [ -n $user ]; then
70
- su $user -c " /usr/bin/dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock"
69
+ su $user -c " DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus /usr/bin/dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock"
71
70
fi
72
71
73
72
In the first step, this script looks for the user-name of the gnome session, i.e. ``user``.
0 commit comments