How to lock screen on Mac OS X? [duplicate]

Possible Duplicates:
Equivalent of Win-L on Mac
Is there a keystroke that can lock the Mac OS X screensaver?

I am using a MacBook Pro running Mac OS X 10.5. I am new to this development environment, and previously worked on Windows.

I am wondering how to lock screen for Mac computer, like Windows Key + L to lock screen for Windows PC?

Thanks in advance.


Solution 1:

as it happens, lifehacker brought a story today about locking the mac:

All you need to know is the Shift+Ctrl+Eject shortcut. By default,
this shortcut simply sleeps your display; wiggle your mouse to wake
it up. That's nice to know, but it's not much of a lock. The solution:

Under System Preferences → Security → General, check ‘Require password 
after sleep or screensaver begins'. This has the advantage of working 
perfectly with the keyboard combo to switch off your display.

or, just to put it into other words: configure the screensaver to ask for the password and then activate the screensaver (either via a key shortcut or by putting the mouse in an active corner and configure osx to activate the screensave while the mouse is in that corner).

Solution 2:

You can use Keychain Access (in your Applications/Utilities folder) to quickly activate your screen saver from the menubar and require a password to turn it off, even if the Security pane option isn't enabled. Open Keychain Access and then go to Keychain Access: Preferences. Click on the General tab and select the Show Status in Menu Bar option. A small lock icon will appear in your menu bar. Close the Preferences window and quit Keychain Access. Now click the lock icon in your menubar and choose Lock Screen to start your screen saver. It can only be unlocked with your account password.

Solution 3:

If you have a menu in your top-right for user switching, go to it and choose 'Login Window'. I use Quicksilver, and I have an AppleScript called 'Lock' that I can run - it simply fires off the following:

do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -suspend"

When I need to go away from my machine, I simply hit Opt+Space, type 'Lock' (often 'lo' will do), hit Enter.

Unlike screensaver based solutions, this means that other users can log in.