diff --git a/sources/tech/20181012 How To Lock Virtual Console Sessions On Linux.md b/sources/tech/20181012 How To Lock Virtual Console Sessions On Linux.md deleted file mode 100644 index 2fb0db2f85..0000000000 --- a/sources/tech/20181012 How To Lock Virtual Console Sessions On Linux.md +++ /dev/null @@ -1,131 +0,0 @@ -translating---geekpi - -How To Lock Virtual Console Sessions On Linux -====== - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/vlock-720x340.png) - -When you’re working on a shared system, you might not want the other users to sneak peak in your console to know what you’re actually doing. If so, I know a simple trick to lock your own session while still allowing other users to use the system on other virtual consoles. Thanks to **Vlock** , stands for **V** irtual Console **lock** , a command line program to lock one or more sessions on the Linux console. If necessary, you can lock the entire console and disable the virtual console switching functionality altogether. Vlock is especially useful for the shared Linux systems which have multiple users with access to the console. - -### Installing Vlock - -On Arch-based systems, the Vlock package is replaced with **kpd** package which is preinstalled by default, so you need not to bother with installation. - -On Debian, Ubuntu, Linux Mint, run the following command to install Vlock: - -``` - $ sudo apt-get install vlock -``` - -On Fedora: - -``` - $ sudo dnf install vlock -``` - -On RHEL, CentOS: - -``` - $ sudo yum install vlock -``` - -### Lock Virtual Console Sessions On Linux - -The general syntax for Vlock is: - -``` - vlock [ -acnshv ] [ -t ] [ plugins... ] -``` - -Where, - - * **a** – Lock all virtual console sessions, - * **c** – Lock current virtual console session, - * **n** – Switch to new empty console before locking all sessions, - * **s** – Disable SysRq key mechanism, - * **t** – Specify the timeout for the screensaver plugins, - * **h** – Display help section, - * **v** – Display version. - - - -Let me show you some examples. - -**1\. Lock current console session** - -When running Vlock without any arguments, it locks the current console session (TYY) by default. To unlock the session, you need to enter either the current user’s password or the root password. - -``` - $ vlock -``` - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/vlock-1-1.gif) - -You can also use **-c** flag to lock the current console session. - -``` - $ vlock -c -``` - -Please note that this command will only lock the current console. You can switch to other consoles by pressing **ALT+F2**. For more details about switching between TTYs, refer the following guide. - -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 at the same time and also disable the virtual console switching functionality, run: - -``` - $ vlock -a -``` - -Again, to unlock the console sessions, just press ENTER key and type your current user’s password or root user password. - -Please keep in mind that the **root user can always unlock any vlock session** at any time, unless disabled at compile time. - -**3. Switch to new virtual console before locking all consoles -** - -It is also possible to make Vlock to switch to new empty virtual console from X session before locking all consoles. To do so, use **-n** flag. - -``` - $ vlock -n -``` - -**4. Disable SysRq mechanism -** - -As you may know, the Magic SysRq key mechanism allows the users to perform some operations when the system freeze. So the users can unlock the consoles using SysRq. In order to prevent this, pass the **-s** option to disable SysRq mechanism. Please remember, this only works if the **-a** option is given. - -``` - $ vlock -sa -``` - -For more options and its usage, refer the help section or the man pages. - -``` - $ vlock -h - $ man vlock -``` - -Vlock prevents the unauthorized users from gaining the console access. If you’re looking for a simple console locking mechanism to your Linux machine, Vlock is worth checking! - -And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-lock-virtual-console-sessions-on-linux/ - -作者:[SK][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.ostechnix.com/author/sk/ -[b]: https://github.com/lujun9972 diff --git a/translated/tech/20181012 How To Lock Virtual Console Sessions On Linux.md b/translated/tech/20181012 How To Lock Virtual Console Sessions On Linux.md new file mode 100644 index 0000000000..5eb290442f --- /dev/null +++ b/translated/tech/20181012 How To Lock Virtual Console Sessions On Linux.md @@ -0,0 +1,127 @@ +如何在 Linux 上锁定虚拟控制台会话 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/vlock-720x340.png) + +当你在共享系统上工作时,你可能不希望其他用户在你的控制台中悄悄地看你在做什么。如果是这样,我知道有个简单的技巧来锁定自己的会话,同时仍然允许其他用户在其他虚拟控制台上使用该系统。要感谢 **Vlock**(**V** irtual Console **lock**),这是一个命令行程序,用于锁定 Linux 控制台上的一个或多个会话。如有必要,你可以锁定整个控制台并完全禁用虚拟控制台切换功能。Vlock 对于有多个用户访问控制台的共享 Linux 系统特别有用。 + +### 安装 Vlock + +在基于 Arch 的系统上,Vlock 软件包被替换为默认预安装的 **kpd** 包,因此你无需为安装烦恼。 + +在 Debian、Ubuntu、Linux Mint 上,运行以下命令来安装 Vlock: + +``` + $ sudo apt-get install vlock +``` + +在 Fedora 上: + +``` + $ sudo dnf install vlock +``` + +在 RHEL、CentOS 上: + +``` + $ sudo yum install vlock +``` + +### 在Linux上锁定虚拟控制台会话 + +Vlock 的一般语法是: + +``` + vlock [ -acnshv ] [ -t ] [ plugins... ] +``` + +这里: + + * **a** – 锁定所有虚拟控制台会话, + * **c** – 锁定当前虚拟控制台会话, + * **n** – 在锁定所有会话之前切换到新的空控制台, + * **s** – 禁用 SysRq 键机制, + * **t** – 指定屏保插件的超时时间, + * **h** – 显示帮助, + * **v** – 显示版本。 + + + +让我举几个例子。 + +**1\. 锁定当前控制台会话** + +在没有任何参数的情况下运行 Vlock 时,它默认锁定当前控制台会话 (TYY)。要解锁会话,你需要输入当前用户的密码或 root 密码。 + +``` + $ vlock +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/vlock-1-1.gif) + +你还可以使用 **-c** 标志来锁定当前的控制台会话。 + +``` + $ vlock -c +``` + +请注意,此命令仅锁定当前控制台。你可以按 **ALT+F2** 切换到其他控制台。有关在 TTY 之间切换的更多详细信息,请参阅以下指南。 + +此外,如果系统有多个用户,则其他用户仍可以访问其各自的 TTY。 + +**2\. 锁定所有控制台会话** + +要同时锁定所有 TTY 并禁用虚拟控制台切换功能,请运行: + +``` + $ vlock -a +``` + +同样,要解锁控制台会话,只需按下回车键并输入当前用户的密码或 root 用户密码。 + +请记住,**root 用户可以随时解锁任何 vlock 会话**,除非在编译时禁用。 + +**3\. 在锁定所有控制台之前切换到新的虚拟控制台** + +在锁定所有控制台之前,还可以使 Vlock 从 X 会话切换到新的空虚拟控制台。为此,请使用 **-n** 标志。 + +``` + $ vlock -n +``` + +**4\. 禁用 SysRq 机制** + +你也许知道,魔术 SysRq 键机制允许用户在系统死机时执行某些操作。因此,用户可以使用 SysRq 解锁控制台。为了防止这种情况,请传递 **-s** 选项以禁用 SysRq 机制。请记住,这只适用于有 **-a** 选项的时候。 + +``` + $ vlock -sa +``` + +有关更多选项及其用法,请参阅帮助或手册页。 + +``` + $ vlock -h + $ man vlock +``` + +Vlock 可防止未经授权的用户获得控制台访问权限。如果你在为 Linux 寻找一个简单的控制台锁定机制,那么 Vlock 值得一试! + +就是这些了。希望这篇文章有用。还有更多好东西。敬请关注! + +干杯! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-lock-virtual-console-sessions-on-linux/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972