【轉】Linux系統下強制踢掉登入使用者
阿新 • • 發佈:2019-01-05
平臺: RHEL5.4
首先可用"w"命令檢視登入使用者資訊, 然後使用"pkill -kill -t pts/x"命令踢使用者(表示使用pkill發出kill訊號踢出終端是pts/x的使用者, 可以同時踢多個使用者), 只有root使用者才能踢人. 舉例如下:
# w
11:52:49 up 61 days, 21:22, 5 users, load average: 0.50, 0.49, 0.47
USER TTY FROM [email protected] IDLE JCPU PCPU WHAT
oracle pts/8 172.16.1.180 25Jul10 37days 0.08s 0.07s rlwrap -s 5000 /u01/app/oracle/product/10.2.0/db_1/bin/sqlplus / as sysdba
oracle pts/10 172.16.1.180 25Jul10 37days 0.00s 0.00s screen -RS hehehehe
oracle pts/11 - 25Jul10 37days 0.03s 0.02s ssh 172.16.1.188
root pts/12 192.168.41.42 10:25 0.00s 0.04s 0.04s -bash
oracle pts/16 172.16.1.180 25Jul10 37days 0.02s 0.02s ssh 172.16.1.188
# pkill -kill -t pts/8,pts/10,pts/11
# w
11:53:14 up 61 days, 21:23, 2 users, load average: 0.46, 0.49, 0.46
USER TTY FROM [email protected] IDLE JCPU PCPU WHAT
root pts/12 192.168.41.42 10:25 0.00s 0.05s 0.05s -bash
oracle pts/16 172.16.1.180 25Jul10 37days 0.02s 0.02s ssh 172.16.1.188
# pkill -kill -t pts/16
# w
11:53:23 up 61 days, 21:23, 1 user, load average: 0.39, 0.47, 0.46
USER TTY FROM [email protected] IDLE JCPU PCPU WHAT
root pts/12 192.168.41.42 10:25 0.00s 0.05s 0.05s -bash
--End--
首先可用"w"命令檢視登入使用者資訊, 然後使用"pkill -kill -t pts/x"命令踢使用者(表示使用pkill發出kill訊號踢出終端是pts/x的使用者, 可以同時踢多個使用者), 只有root使用者才能踢人. 舉例如下:
# w
11:52:49 up 61 days, 21:22, 5 users, load average: 0.50, 0.49, 0.47
USER TTY FROM [email protected] IDLE JCPU PCPU WHAT
oracle pts/8 172.16.1.180 25Jul10 37days 0.08s 0.07s rlwrap -s 5000 /u01/app/oracle/product/10.2.0/db_1/bin/sqlplus / as sysdba
oracle pts/10 172.16.1.180 25Jul10 37days 0.00s 0.00s screen -RS hehehehe
oracle pts/11 - 25Jul10 37days 0.03s 0.02s ssh 172.16.1.188
root pts/12 192.168.41.42 10:25 0.00s 0.04s 0.04s -bash
oracle pts/16 172.16.1.180 25Jul10 37days 0.02s 0.02s ssh 172.16.1.188
# pkill -kill -t pts/8,pts/10,pts/11
# w
11:53:14 up 61 days, 21:23, 2 users, load average: 0.46, 0.49, 0.46
USER TTY FROM [email protected] IDLE JCPU PCPU WHAT
root pts/12 192.168.41.42 10:25 0.00s 0.05s 0.05s -bash
oracle pts/16 172.16.1.180 25Jul10 37days 0.02s 0.02s ssh 172.16.1.188
# pkill -kill -t pts/16
# w
11:53:23 up 61 days, 21:23, 1 user, load average: 0.39, 0.47, 0.46
USER TTY FROM [email protected] IDLE JCPU PCPU WHAT
root pts/12 192.168.41.42 10:25 0.00s 0.05s 0.05s -bash
--End--