It is easy to lock screen when using any of the available desktop environment or even basic X Window utilities. The more interesting thing is to achieve the same functionality on text only based system.
$ sudo apt-get install vlock
Add selected users to the vlock group, so they can load and use dangerous (
$ sudo usermod -a -G vlock milosz
Modules and their permissions currently available in Debian Wheezy.
$ ls -l /usr/lib/vlock/modules/ -rwxr-xr-x 1 root root 5936 Jun 19 2008 all.so -rwxr-x--- 1 root vlock 10248 Jun 19 2008 new.so -rwxr-x--- 1 root vlock 10256 Jun 19 2008 nosysrq.so
Modules and their permissions currently available in Debian Jessie.
$ ls -l /usr/lib/vlock/modules/ -rwxr-xr-x 1 root root 5296 Jul 15 2014 all.so -rwxr-xr-- 1 root vlock 5408 Jul 15 2014 nosysrq.so
Lock current console
Use the following command to lock current console.
$ vlock -c
Lock every console
Use the following command to lock every console, disable switching between them and disable SysRq mechanism.
$ vlock -a -s
Lock every console directly from X session or remotely over SSH session
Use the following command to lock every console, disable switching between them, disable SysRq mechanism and switch to new console.
$ vlock -a -s -n
vlock-main manual pages and documentation available in
You can use this utility with your favorite screen multiplexer.
vclock is just a shell script executing
vlock-main binary. Inspect it to customize your own solution.