標籤:linux 踢除 使用者 強制
Linux系統下強制踢掉登入使用者
linux系統root使用者可強制踢制其它登入使用者,首先可用w命令查看登入使用者資訊,顯示資訊如下:
[[email protected] ~]# w
15:49:22 up 18:24, 5 users, load average: 0.00, 0.03, 0.10
USER TTY [email protected] IDLE JCPU PCPU WHAT
root tty1 2days 0.11s 0.00s xinit /etc/X11/xinit/xinitrc -- /usr/bin/X :0 vt1 -auth /root/.serverauth
root pts/0 14:05 1:54 0.20s 0.20s bash
oracle pts/1 14:16 40:26 0.19s 0.18s -bash
root pts/2 15:09 1:46 0.47s 0.47s -bash
root pts/3 15:49 2.00s 0.34s 0.21s w
強制踢人命令格式:pkill -kill -t tty
pkill -kill -t tty1
pkill -kill -t pts/1
解釋:
pkill -kill -t 踢人命令
tty 所踢使用者的TTY
如上踢出oracle使用者的命令為: pkill -kill -t pts/1
只有root使用者才能踢人,至少我測試的是這樣的。如果同時有二個人用root使用者登入,任何其中一個可以 踢掉另一個。任何使用者都可以踢掉自己-_-
如何踢掉用終端登陸的使用者,如:
root pts/0 14:05 1:54 0.20s 0.20s bash
首先用命令查看pts/0的進程號,命令如下:
[[email protected] ~]# ps -aux |grep pts/0
root 98041 0.0 0.1 116664 2988 pts/0 Ss+ 14:05 0:00 bash
root 109210 0.0 0.0 116840 988 pts/3 R+ 15:58 0:00 grep --color=auto pts/0 踢掉使用者的命令:
kill -9 98041
本文出自 “技術成就夢想” 部落格,請務必保留此出處http://pizibaidu.blog.51cto.com/1361909/1612428
Linux系統下強制踢掉登入使用者