I'm trying to add a script that will take a picture when someone unlocks my machine, as per this question. Right now, I have fprint
setup so that I can unlock using my fingerprint - the line auth sufficient pam_fprintd.so
is in /etc/pam.d/system-auth
(as well as /etc/pam.d/sudo
, /etc/pam.d/lightdm
, /etc/pam.d/lightdm-autologin
, for convenience).
I have written a script that does this, and I found this question and answer useful - basically add the line
session optional pam_exec.so /path/script.sh
to /etc/pam.d/system-auth
.
However, this takes a picture every time my authentication is required/used. This is a bit of overkill for me, and I want to avoid this.
Where/how can I add pam_exec.so /path/script.sh
such that everytime I unlock, the script runs?
Also, is there a reasonably simplified resource explaining how pam.d
works on Arch based systems? The Arch wiki and this page are alright, but are missing some points I feel.