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