Open System Preferences
Click on the Apple in the upper-left-hand corner of the screen, then choose System Preferences.
Requiring a password to resume from screen saver
Click the Security icon within System Preferences:
Under General, check the box next to "Require password immediately after sleep or screen saver begins":
Setting Screen Saver to Start Automatically
Click Show All to return to the main System Preferences menu, then click the Desktop & Screen Saver icon:
We recommend setting your screen saver to start automatically after 5 minutes:
Manually locking your computer
Even though you have your screen saver set to start automatically, it's recommended that you start your screen saver whenever you step away from your computer, even to head down the hall.
Before you can do this, you must set a "Hot Corner" in the Expose and Spaces area of System Preferences:
Under the Expose section, you can set your computer to activate your screen saver when your mouse enters a particular corner of your screen:
Once this is saved, you can activate your screen saver manually any time by moving your mouse cursor to the upper-right-hand corner of your screen.