2016年11月3日 星期四

[Linux 常見問題] How do you kick a benign user off your system?

Source From Here
Question
I was googling this a bit ago and noticed a couple of ways, but I'm guessing that google doesn't know all. So how do you kick users off your Linux box? also how do you go about seeing they are logged in in the first place? and related... does your method work if the user is logged into an X11 DE (not a requirement I'm just curious)?

How-To
There's probably an easier way, but I do this:
1. See who's logged into your machine -- use who or w:
# who
guest pts/2 2016-11-03 17:19 (61-228-152-120.dynamic.hinet.net)
john pts/1 2016-11-03 17:18 (61-228-152-120.dynamic.hinet.net)

2. Look up the process ID of the shell their TTY is connected to:
// ttylist: Select by tty. Nearly identical to -t and --tty, but can also be used with an empty ttylist to indicate the terminal associated with ps.
# ps t 2 // Here we want 'guest' to out
PID TTY STAT TIME COMMAND
14624 pts/2 Ss+ 0:00 -bash

3. Laugh at their impending disconnection (this step is optional, but encouraged)
# echo "HAHAH" | write guest pts/2

4. Kill the corresponding process:
# kill -9 14624


沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...