输入错误密码或“扫描指纹错误”时让网络摄像头拍照?

asa*_*kci 6 authentication webcam fingerprint-reader login

我正在使用笔记本电脑。我想在输入错误密码或“扫描指纹错误”时拍照。我刚刚找到了有关第一部分的问题/答案(输入错误密码时可以让网络摄像头拍照吗?

但没有关于指纹的信息。我执行了这些步骤,但没有任何效果。我认为这与我的指纹使用情况有关。

这是我的默认“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
Run Code Online (Sandbox Code Playgroud)

我怎样才能像这样整理这个脚本:如果密码错误“或”扫描指纹错误,会拍照吗?提前致谢(抱歉英语不好,这不是我的母语)

asa*_*kci 1

Pam总是惹麻烦,然后我决定应用这篇文章中的第二个答案(Can I make the webcam take a picture when an invalid password is Entered?)这解决了我的问题,只需正常密码登录,但指纹登录错误行动仍然不起作用。

我的TakePicture.sh代码:(已编辑,现在代码拍摄 3 张图片,间隔 0.5 秒)

#!/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
Run Code Online (Sandbox Code Playgroud)

我的TakePicture.service代码(在/etc/systemd/system/

[Unit]
Description=Take Picture

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

[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)