You can set your Mac OS X account to automatically lock the screen so that the password is required after a certain amount of time of inactivity, but can you do the same thing using a schedule (say at 5:30 PM every day)? Kind of like how you can have the computer turn on/off or go to/wake up from sleep at a certain time.
MacOS – scheduled account lock Mac OS X
macosschedulescreen-lockSecurity
Related Question
- Prevent users from unchecking “require password to wake computer from sleep or screen saver”
- MacOS – Why is Mavericks forcing a password reset on every lock screen
- MacOS – How to cut off/block all traffic when I lock the screen (and resume when unlocking) in MacOS
- Lock Screen using terminal? Osascript is preventing keystrokes
- Screen won’t lock after upgrading to Catalina
Best Answer
You can use
launchd
to do this. Place the following xml into a new text file in~/Library/LaunchAgents/
and call it something descriptive with a suffix of.plist
. For example, mine is~/Library/LaunchAgents/logoutAt1730.plist
.If you want it to run on the current power cycle (Eg you don't want to restart for this to take effect) use
launchctl load ~/Library/LaunchAgents/logoutAt1730.plist
to telllaunchd
about the new item. It should load automatically next time you login.Use
launchctl list
and look for the label string (Logout at 5:30 PM) to validate thatlaunchd
knows about the item.I have verified this works on my workstation. I don't know why
cron
doesn't.