How do I terminate a user session under Linux?

Source: Internet
Author: User
Tags session id sessions pkill

How do I terminate a user session under Linux?


The monitoring tool used by the company is cacti, and the setting in the threshold is the alarm when there are more than 2 logged-in users . So, my question comes out, how to terminate more user sessions? I myself is which user session , always can not oneself to terminate the conversation.


Step one: See which IP is on the operations server, who command

[email protected] ~]# who

Root Tty1 2014-04-20 08:42

Root pts/0 2014-04-20 09:10 (192.168.204.50)

Step two: See what sessions the server has (what are you doing ),w command

[Email protected] ~]# W

10:50:04 up 2:08, 2 users, Load average:0.00, 0.00, 0.00

USER TTY from [email protected] IDLE jcpu PCPU

Root tty1-08:42 1:40m 0.04s 0.04s-bash

Root pts/0 192.168.204.50 09:10 0.00s 0.07s 0.00s W

Step Three: view your session ID,TTY command

[[email protected] ~]# TTY

/dev/pts/0

Fourth step: Kill the session that is not in use,pkill-9-t tty1 or pkill-kill-t tty1

[Email protected] ~]# pkill-9-t Tty1

[Email protected] ~]# W

10:54:13 up 2:12, 1 user, Load average:0.00, 0.00, 0.00

USER TTY from [email protected] IDLE jcpu PCPU

Root pts/0 192.168.204.50 09:10 0.00s 0.07s 0.00s W

As a result, there is only one user session left.


This article is from the "Youth Deng Yong" blog, please be sure to keep this source http://dengyong.blog.51cto.com/8409869/1430411

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.