How to Automatically Log Out of Your Mac
You can schedule an automatic log out of your Mac, if you live or work in an environment where you don't want just anyone to walk up to your Mac and be able to see what you've been up to.
Go to the Security pane of System Preferences, click General, and select the Require Password to Wake This Computer from Sleep or Screen Saver option and the Log Out after x Minutes of Inactivity option.
You also may want to select the options to Disable Automatic Login and Use Secure Virtual Memory. The latter setting ensures that data stored in virtual memory is encrypted. You’ll have to restart the computer for the change to take effect. You can even disable a remote control infrared receiver.
If you’re really distrustful, select the Require Password to Unlock Each System Preferences pane option.