What follows are few tips on how to lock screen on a Linux system running KDE4 desktop manager. This is quite effective if you forget to lock your screen on your working Linux desktop in the office and you do not wish anyone to tinker with your box.

To lock your KDE4 screen locally all you need to do is to run a following command:
$ /usr/lib/kde4/libexec/kscreenlocker --forcelock
Here is how you can lock screen as a root user from virtual console. Please note that root password will be required to unlock screen:
# export DISPLAY=:0.0
# xhost +local:root
# /usr/lib/kde4/libexec/kscreenlocker --forcelock

Next, let's see how we can lock KDE4 screen remotely. Login remotely via ssh to your desktop:
$ ssh -X lubos@my-kde4-desktop
Once you ssh to your remote system execute a following command to lock your screen:
$ DISPLAY=:0.0; /usr/lib/kde4/libexec/kscreenlocker --forcelock