In this post, How to use vlock command Lock Your Terminal Sessions on Linux. Keep your Linux safe from Prying eyes
Use vlock command can keep unauthorized users from Linux command line.
vlock command is a command-line program that will lock your Linux terminal, as well as virtual consoles.
Install vlock command on Linux
On Debian/Ubuntu:
sudo apt install vlock
on an RHEL-based distro like Fedora or CentOS, vlock should be installed by default. If it isn't, your run command as below:
sudo dnf install kbd
Lock Your Terminal With vlock command
vlockThe display the message, "This TTY is now locked."
To use your terminal, press Enter and vlock will prompt you for your password.
Locking All Virtual Terminals on Linux
With the -a or --all flag to lock all Virtual Terminal on Linux.
vlock --allThis will lock all the virtual terminals on your system