End other ssh login users in CentOS

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.