howdy
howdy copied to clipboard
Any way to use howdy in a script ?
I want to use howdy to periodically check if I am the one using the computer. So, it can lock it in case someone else is using it. Maybe use a while loop to check with howdy every n seconds then if I am there it will rerun otherwise lock the system or run a command. Is there a way to achieve it ?
Thank you for the great project !!
Yes, you can install pamtester, and if you have howdy configured for login, you can use something like this script. Install it as a service and it will work.
#!/bin/bash
CHECK_INTERVAL=300
while true; do
if timeout 5 pamtester login $USER authenticate; then
echo "$(date): User recognized."
else
echo "$(date): User NOT recognized — locking session!"
loginctl lock-session
fi
sleep $CHECK_INTERVAL
done