
linux强制注销用户
We have some servers to manage. There are some user access to our server. We want to them log off or kill their processes by terminating. How can be achieve this?
我们有一些服务器要管理。 用户可以访问我们的服务器。 我们想让他们注销或终止他们的进程。 如何才能做到这一点?
列出已登录的用户 (List Logged On Users)
We can logout other users forcibly like below. Keep in mind we need to be root to complete this command. First we will list currently logged in users with the who
command. We can use w
command alternatively to list users.
我们可以像下面这样强制注销其他用户。 请记住,我们需要以root用户身份才能完成此命令。 首先,我们将使用who
命令列出当前登录的用户。 我们也可以使用w
命令来列出用户。
$ who

从GUI或桌面环境注销(Logout From GUI or Desktop Environment)
Different desktop environments provides GUI menus in order to logout from current session. In this example we will logout the user ismail
from and XFCE desktop environment session. From right corner by clicking the user name we will list some menu which provides actions like Lock Screen
, Suspend
, Shutdown
and Log Out
. We can use Log Out
button in order to logout from current user session.
不同的桌面环境提供GUI菜单,以便从当前会话注销。 在此示例中,我们将从XFCE桌面环境会话注销用户ismail
。 通过单击用户名从右上角,我们将列出一些菜单,该菜单提供诸如Lock Screen
, Suspend
, Shutdown
和Log Out
。 我们可以使用“ Log Out
按钮以便从当前用户会话中注销。

注销命令(logout Command)
We can logout from current Linux user from terminal with the logout
command.
我们可以使用logout
命令从当前Linux用户从终端logout
。
$ logout

注销当前用户(Logout Current User)
We will use pkill
command. This command will kill all processes owned by the given user with the -u
option. In this example we know that the user ismail
is logged in. We will log out the user ismail
. We will also provide the -KILL
option which will kill all processes related with the user ismail
. Keep in mind that this will suddenly stop all this user related processes. This
我们将使用pkill
命令。 此命令将使用-u
选项杀死给定用户拥有的所有进程。 在此示例中,我们知道用户ismail
已登录。我们将注销用户ismail
。 我们还将提供-KILL
选项,该选项将-KILL
与用户ismail
相关的所有进程。 请记住,这将突然停止所有与用户相关的过程。 这个
$ pkill -KILL -u test2
User -u test2 is logout
用户-u test2已注销
pkill is the command which will send signals to the provided user processes
pkill是将信号发送到提供的用户进程的命令
-KILL is the kill signal to the specified user processes.
-KILL是指定用户进程的终止信号。
如何在Linux中强制注销用户? 信息移植 (How To Logout Logoff User Forcibly in Linux? Infografic)

翻译自: https://www.poftut.com/logout-logoff-user-forcibly-linux/
linux强制注销用户