Automatic Screen Lock at Removal script

I bought a Nitrokey Pro 2 and found this article on your documentation website.

https://docs.nitrokey.com/pro/linux/automatic-screen-lock.html

My computer is running a Debian 10.10 with Gnome 3.30.2. Unfortunately the article does not work somehow for me. I did all steps gave execute rights (chmod +x) to the script and ran it as a test from the root terminal.
First of all it works, then I ran it manually from a normal terminal. Now I was prompted to enter the user password and the computer got locked. The user is not in the sudoers file or in sudo group.

Now I unplugged the Nitrokey and nothing happens. Is it a problem from Debian or does it only run on Ubuntu?

Do you have a idea?

I haven’t received an answer. Can you give it a look? Do you need more information?

1 Like

hey @DieRuebe,

generally there might be slight differences between how ubuntu & debian handle things. But you should easily be able to debug this. There are 2 components here which play together: udev and a simple script.

So 1st step would be to find out if your script gets called, if you remove your nitrokey. Just add a line like this echo "hello hello" > /tmp/mytest as the first line into your script. This will write a file /tmp/mytest if the script gets called by udev on removal of your nitrokey.

Is this working ? if yes, the problem is within your script, if not the problem is within your udev rule. I would guess udev is your problem, but as you now have a way to test this, you can check the various parts of your rule (e.g., check if the script location is correct, check if the product id matches the output of lsusb).

On top of that, did you reboot ? and or reload the udev rules, guess it was like this: udevadm control --reload-rules && udevadm trigger, because afaik the rules are not reloaded automatically.

best