When you are working on a shared system, you probably don't want other users to be able to peek into your console and see what you are doing. If so, I know of a simple trick to lock my own session while still allowing other users to use the system on other virtual consoles. Thanks to Install Vlock On Arch based systems, the Vlock package is replaced with the kpd package which is preinstalled by default, so you don't need to bother with the installation. On Debian, Ubuntu, Linux Mint, run the following commands to install Vlock: $ sudo apt-get install vlock On Fedora: $ sudo dnf install vlock On RHEL, CentOS: $ sudo yum install vlock Locking a Virtual Console Session on Linux The general syntax of Vlock is: vlock [ -acnshv ] [ -t <timeout> ] [ plugins... ] here:
Let me give you some examples. 1. Lock the current console session When Vlock is run without any arguments, it locks the current console session (TYY) by default. To unlock the session, you will need to enter the current user's password or the root password. You can also use the -c flag to lock the current console session. Note that this command only locks the current console. You can switch to another console by pressing ALT+F2. For more details on switching between TTYs, see the following guides. Also, if the system has multiple users, the other users can still access their respective TTYs. 2. Lock all console sessions To lock all TTYs simultaneously and disable virtual console switching, run: Likewise, to unlock the console session, just press Enter and enter the current user's password or the root user password. Remember that the root user can unlock any vlock session at any time, unless disabled at compile time. 3. Switch to a new virtual console before locking all consoles You can also make Vlock switch from an X session to a new empty virtual console before locking all consoles. To do this, use the -n flag. 4. Disable SysRq mechanism As you may know, the Magic SysRq key mechanism allows the user to perform certain actions when the system freezes. Therefore, the user can unlock the console using SysRq. To prevent this, pass the -s option to disable the SysRq mechanism. Remember that this option only works with the -a option. For more options and their usage, see the help or man pages. Vlock prevents unauthorized users from gaining access to the console. If you're looking for a simple console locking mechanism for Linux, Vlock is worth a try! Summarize The above is the implementation method of locking the virtual console session on Linux introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Implementation of Webpack3+React16 code splitting
>>: MySQL 5.6.33 installation and configuration tutorial under Linux
RGBA is a CSS color that can set color value and ...
Recently I used vue to learn to develop mobile pr...
Generally, when we use a table, we always give it...
JavaScript shows and hides pictures, for your ref...
In a complex table structure, some cells span mul...
In this article, the blogger will take you to lea...
Table of contents Preface How to switch between m...
Newer Linux distributions no longer have the rc.l...
If there is a table product with a field add_time...
Table of contents What is nodejs Install NodeJS H...
Question Guide 1. How does Hadoop 3.x tolerate fa...
Table of contents Preface Global parameter persis...
Table of contents Preface: Implementation steps: ...
Nowadays, whether you are working on software or w...
WeChat applet uses scroll-view to achieve left-ri...