6

I'm using laptop. And I want to take a photo when an incorrect password is entered or "wrong fingerprint scanned". I just found a question/answer about first part (Can I make the webcam take a picture when an incorrect password is entered?)

But there is no information about fingerprint. I made these steps but nothing works. I think this is about my fingerprint usage.

Here is my default "etc/pam.d/common-auth":

auth    [success=3 default=ignore]  pam_fprintd.so max_tries=1 timeout=10 # debug
auth    [success=2 default=ignore]  pam_unix.so nullok try_first_pass
auth    [success=1 default=ignore]  pam_sss.so use_first_pass
# here's the fallback if no module succeeds
auth    requisite           pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump around
auth    required            pam_permit.so
# and here are more per-package modules (the "Additional" block)
auth    optional            pam_cap.so 
# end of pam-auth-update config

How can I tidy this script like that way: If there are wrong password "or" wrong scanned fingerprint, will take photo? thanks in advance (sorry for bad English, it is not my native language)

1 Answers1

1

Pam was always causing trouble, then I decided to apply the second answer in this post (Can I make the webcam take a picture when an incorrect password is entered?) This solved my problem with only a normal password login, but the fingerprint wrong login action still not working.

my TakePicture.sh Code: (Edited, Now Code Takes 3 Picture 0.5 second apart)

#!/bin/bash

while inotifywait -q -e modify /var/log/auth.log >/dev/null

do

    if (( $(tail -1 /var/log/auth.log | grep failure | wc -l) == 1))

    then

            echo "failed login"

            date_=`date  +%x`
            time_=`date  +%X`
            ffmpeg -f video4linux2 -s vga -i /dev/video0 -vframes 1 /tmp/WAR-$date_-$time_-1.jpg
            sleep 0.5
            time_=`date  +%X`
            ffmpeg -f video4linux2 -s vga -i /dev/video0 -vframes 1 /tmp/WAR-$date_-$time_-2.jpg
            sleep 0.5
            time_=`date  +%X`
            ffmpeg -f video4linux2 -s vga -i /dev/video0 -vframes 1 /tmp/WAR-$date_-$time_-3.jpg

    fi


done

my TakePicture.service code (in /etc/systemd/system/)

[Unit]
Description=Take Picture

[Service] Type=Simple ExecStart=/home/asandikci/TakePicture.sh

[Install] WantedBy=multi-user.target