Thursday, March 21, 2013

Lock Your OSX Computer

Fun tip. It is not obvious how to lock an OSX computer without logging off. After some searching a ran across a Gist which suspends the current session. This is equivalent to locking (Win+L) a Windows computer.
lock:
1
2
#!/bin/bash
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
If you save that into a file, you can make it executable by running:
Make lock executable:
1
$ chmod 755 lock
This works great since I always have a terminal window open. Presuming the file is accessible via the path. I can just run the following and it locks the Mac.
Execute lock:
1
$ lock

No comments: