physlock is a simple and lightweight utility for Linux that can be used to lock all of the consoles and virtual terminals on a system. It is similar to other screen locking utilities, such as xlock or vlock, but physlock is designed to lock the physical console and virtual terminals, rather than just the X11 display. physlock can be run as a regular user, and it requires no special privileges to lock the consoles and virtual terminals. It runs in the background and prevents access to the system until the correct password is entered.
To use physlock, simply run the following command:
# physlock
This will lock all of the available virtual terminals and consoles, and prevent access to the system until the correct password is entered. When the system is locked, any attempt to switch to another virtual terminal or console will result in a message indicating that the system is locked, and that the password must be entered to unlock it. physlock is a useful utility for ensuring the security of a system when it is unattended, and it can also be used to prevent unauthorized access to sensitive information on a multi-user system. If you need to lock your system to prevent access, or if you simply want to prevent others from using it while you are away, physlock is a simple and effective tool that can help you to achieve your goal.
If you encounter the below error while running the command physlock:
physlock: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install physlock |
Ubuntu | apt-get install physlock |
Arch Linux | pacman -S physlock |
Kali Linux | apt-get install physlock |
Raspbian | apt-get install physlock |
physlock Command Examples
1. Lock every console (require current user or root to unlock):
# physlock
2. Mute kernel messages on console while locked:
# physlock -m
3. Disable SysRq mechanism while locked:
# physlock -s
4. Display a message before the password prompt:
# physlock -p "Locked!"
5. Fork and detach physlock (useful for suspend or hibernate scripts):
# physlock -d