The vc-lock program

vc-lock console command [arg ...]

vc-lock uses the given console to lock all virtual consoles. It disables console switching, runs command repeatedly until it exits zero, re-enables console switching, and exits. console may be specified as a file descriptor or path; it is typically given as /dev/tty. Currently, vc-lock is only known to work on Linux systems.