0

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.

nonreligious
  • 113
  • 6

1 Answers1

0

When you lock your computer, touch one file

touch /tmp/ilockedmycomputer

and from shutter script check this file. If exist, take a photo, and delete the file. If not exist do nothing. Or check this: How to run a script on screen lock/unlock?

K-attila-
  • 642
  • 1
    Thanks - I is not quite what I was looking for, but it will be my fallback plan if I can't get anything else to work. – nonreligious Aug 17 '21 at 21:03