End other ssh login users in CentOS
It is also necessary to limit the number of SSH connections and manually disconnect idle connections. Here, the process of manually picking other users in Linux is written.
1. view online users of the system
[root@whh ~]# w14:30:26 up 38 days, 21:22, 3 users, load average: 0.00, 0.01, 0.05USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATroot pts/0 162.16.16.155 14:30 0.00s 0.07s 0.05s wroot pts/1 162.16.16.155 14:30 12.00s 0.01s 0.01s -bashroot tty1 :0 05Dec13 38days 2:16 2:16 /usr/bin/Xorg :0 -nr -verbose -audit 4 -auth /var/run/gdm/auth-for-gdm-LrK8wg/database -noliste
2. Check which terminal belongs to you at this time (I have opened two connections)
[root@whh ~]# who am iroot pts/0 2017-11-13 14:30 (162.16.16.155)
3. pkill a terminal that is not applicable to you
[Root @ whh ~] # Pkill-kill-t pts/1
4. view the current terminal information
[root@linuxidc ~]# w 14:31:04 up 38 days, 21:23, 2 users, load average: 0.00, 0.01, 0.05USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATroot pts/0 162.16.16.155 14:30 0.00s 0.04s 0.01s wroot tty1 :0 05Dec13 38days 2:16 2:16 /usr/bin/Xorg :0 -nr -verbose -audit 4 -auth /var/run/gdm/auth-for-gdm-LrK8wg/database -noliste[root@linuxidc ~]#
Note:
If the task is still not killed, we recommend that you add-9 to force the task to be killed.
[root@whh ~]# pkill -9 -t pts/1