These instructions are for Ubuntu 11.10 running the Unity interface. They may be the same for other version combinations, but no guarantee is made.
Sometimes you have to leave your computer but don’t want to leave your session open for someone else to start using.
One option is to log out, the other is to lock your session. Logging out is rather drastic and requires you to save all your work. Locking the screen allows all your work to remain as is until your return.
Keyboard Shortcut
1) Press Ctrl+Alt+L to lock your screen.
NOTE: pressing Ctrl+Alt+L means: simultaneously hold down the Ctrl key and Alt key, then press the L key as though you intend to type it. DO NOT press the shift key because Ctrl+Alt+Shift+L is different from Ctrl+Alt+L
Your screen should change to something like the following (your choice of desktop background, username, etc, will affect the specific appearance):
Using the Mouse
2) Select Lock Screen from the System icon in the top right corner of the screen: