I am trying to monitor the changes in the /etc/shadow file continuously using inotifywait. But, it is only detecting only the first event.
sudo inotifywait -m -e attrib /etc/shadow |
while read E; do
echo "File modified"
done
This is the code snippet. When I change the password for a user, while loop echo statement gets executed. But when I change the password for the second time, it is not getting executed.
NOTE: I am using the -m flag for inotifywait to continue execution.