Ubuntu: How to take a photo from webcam when someone attempt to open a password protected PDF?


I am using Ubuntu 14.04 and want to add a security feature to my system. From this question, I came to know how to take picture when an incorrect password entered in login screen, using the following script,

#!/bin/bash  ts=`date +%s`  ffmpeg -f video4linux2 -s vga -i /dev/video0 -vframes 3 /tmp/vid-$ts.%01d.jpg  exit 0  #important - has to exit with status 0  

After making it executable, I am able to take pictures from my webcam with this script.

I have some confidential PDF documents which are password protected. Now I want to do the same thing again. I want to take picture, if someone attempts to open those files with incorrect password. How to do that?


You could accomplish this with Incron.

Install Incron sudo apt-get install incron and configure it with incrontab -e similar to adding regular cron jobs.

eg. /path/to/pdf/files/ IN_ACCESS /path/to/script.sh save and voila.

NOTE: Do not do any action from within a incron job in a directory that you monitor to avoid loops. Example: When you monitor the /tmp directory for changes and each change triggers a script that writes a log file in /tmp, this will cause a loop and might bring your system to high load or even crash it. - Quoted from https://www.howtoforge.com/tutorial/trigger-commands-on-file-or-directory-changes-with-incron/

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »