Posted on 04-05-2017 03:32 PM
Greetings,
Running into a scenario in our Mac Labs where users are leaving their accounts logged in, requiring the next person to force reboot the computer. I know there's the option to force logout through a configuration profile based on idle time, but I'm hoping to give the option to log them out or cancel and log back in if the user is actually still around.
Anyone have any ideas on how to trigger a script when the screen saver launches, or even better when the computer is brought back from screensaver and lands on the login screen?
I've tried playing with ScriptSaver, but can't get it to run with the privileges needed to force the logout.
Here's the script I put together:
#!/bin/bash
PROMPT=`/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -lockhud -heading "Force Log Out" -description "If a previous user has left a computer logged in, you can use the button below to force log them out. Be certain they are gone, as they
will lose any unsaved work." -icon /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GroupIcon.icns -button1 "Log Out" -button2 Cancel`
echo "result $PROMPT"
if [ "$PROMPT" == "0" ];
then
pkill loginwindow
else
exit 0
fi
exit 0
I'm probably trying too hard to fit this scenario, and just need to use the idle log out, but figured I'd see if anyone had ideas to make it happen.
Open to any suggestions, thanks!
Posted on 04-05-2017 04:32 PM
Why not enable fast user switching so a second user can still log in?
Then if required have a login policy that checks for and logs out other accounts on the machine.
Posted on 04-06-2017 08:35 AM
.
Posted on 04-06-2017 08:36 AM
@Look I'll give that a shot, thanks for the suggestion! Might need to do a custom wallpaper on the lock screen so students recognize the button and the ability to still login.