Linux Close Online Login user

Source: Internet
Author: User
Tags pkill

When using the computer, found that their computer has other users to log on. If other users are using their own name, then can be queried through the WHO, but if the login is the root user, then certainly do not know who, so we need to clear them, in addition, if the landing of the user suddenly broken, then there must be outdated login information need to clear

1, locate the landing port;
# WHO
Root PTS/1 Apr 8 00:06 (172.29.0.29)
Root PTS/2 Apr 8 04:15 (172.29.0.21)

2, notify the user that he will be closed:
# echo "I'll close your connection" >/DEV/PTS/2
This will display the information for his terminal.

3. Turn off user connections
# fuser-k/DEV/PTS/2


In Linux system Management, we sometimes need to end all processes of a user. Beginners will generally check out all of the user's PID, and then kill each end, or write a script. In fact, there are many ways to end, the blogger side summarizes the following 4 ways to kill user Zhangnq as an example.

1. Pkill mode

# pkill-u ZHANGNQ

2. Killall mode

# killall-u ZHANGNQ

3 PS mode PS list zhangnq pid, and then kill off, more cumbersome.

# Ps-ef | grep ZHANGNQ | awk ' {print $} ' | Xargs kill-9

4. Pgrep mode pgrep-u parameter isolate all PID of the user, and then kill

# Pgrep-u Zhangnq | Xargs kill-9

Linux Close Online Login user

Related Article

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.