Is there a way to lock macOS so that waking it up requires the user’s password? (Even If normally the password won’t be requested if it is waked up in, say, 1 hour)
macOS – How to Lock with Password from Bash
command linemacospasswordscreen-lockSecurity
Best Answer
This should work on most versions
The
-suspend
line will switch to the login screen (which takes a few seconds, hence thesleep 5
before the next command).The
pmset
line will sleep the display.The
osascript
line will sleep the computer.Only the
-suspend
line is necessary to require the password, so you can choose to include the other lines, or not, as you wish.