If you are working in an environment that is not secure, such as a student computing lab or a large office, it is important that you are familiar with ways of securing your console sessions.
There are a number of locking programs that will secure a single virtual console, such as vlock:
<~>% vlock
This TTY is now locked.
Please enter the password to unlock.
graeme's password:
Note that this doesn't prevent a user from switching to another virtual console and logging in from there - it simply locks the current virtual console.
The screen program can also be used to lock the console, by pressing Control-A x:
Screen used by Graeme Cross <graeme>.
Password:
xlock is one of the more common X-Windows screensavers, and it features a lock which requires the user to enter a password before regaining access to the session.
There are a variety of features and modes, but the following line will lock the X-Windows session with a random screensaver mode:
xlock -mode random
One of the annoying things about xlock is that (unlike the MS Windows screensavers) it does not automatically lock the screen after a certain time of keyboard inactivity. A program called xautolock will do this for you and can be run with other programs.
For example, the following line will activate xlock in the swirl mode after 5 minutes:
xautolock -time 5 -locker "xlock -nice 0 -mode swirl" &
The KDE environment has a locking screensaver: pressing the padlock icon in the panel will automatically lock the screen and the screensaver can also be configured to lock the screen after N minutes of input inactivity.