centos 强制踢掉某登录用户的方法
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>linux是一个多用户操作系统,用户可以在不同的地方链接上LINUX服务器,在系统中我们可以用w或者who来查看用户</p>
<div class="jb51code" style='margin: 0px; padding: 0px; outline: none; line-height: 25.2px; font-size: 14px; width: 660px; overflow: hidden; clear: both; font-family: tahoma, arial, "Microsoft YaHei";'>
<pre class="brush:bash;">
# who
root pts/0 2018-05-5 20:45 (58.63.138.162)
root pts/1 2018-05-5 22:24 (118.186.197.221)
# w
22:33:29 up 4 days, 8:05, 2 users, load average: 1.58, 1.36, 1.47
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 58.63.138.162 20:45 0.00s 0.03s 0.00s w
root pts/1 118.186.197.221 22:24 4:40 0.02s 0.02s -bash
</pre>
</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
看看那个是自己登录得到</p>
<div class="jb51code" style='margin: 0px; padding: 0px; outline: none; line-height: 25.2px; font-size: 14px; width: 660px; overflow: hidden; clear: both; font-family: tahoma, arial, "Microsoft YaHei";'>
<pre class="brush:bash;">
# who am i
root pts/0 2013-05-17 20:45 (58.63.138.162)
pkill,pts/1</pre>
</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
接下来使用pkill踢掉用户</p>
<blockquote style='margin: 0px auto 10px; padding: 4px 4px 4px 10px; outline: none; background: rgb(244, 249, 251); border-left: 4px solid rgb(116, 205, 230); width: 665px; font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>
<p>
# pkill -kill -t pts/1</p>
</blockquote>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
接着用w或者who</p>
<div class="jb51code" style='margin: 0px; padding: 0px; outline: none; line-height: 25.2px; font-size: 14px; width: 660px; overflow: hidden; clear: both; font-family: tahoma, arial, "Microsoft YaHei";'>
<pre class="brush:bash;">
# w
22:40:43 up 4 days, 8:12, 1 user, load average: 1.58, 1.36, 1.40
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 58.63.138.162 20:45 0.00s 0.03s 0.00s w</pre>
</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
大功告成</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
<strong>下面是图文步骤</strong></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
centos强制踢掉某登录用户</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
首先,我们使用w查看一下有哪些在登录,例如得到结果如下</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
<img style="max-width:100%!important;height:auto!important;"title="centos 强制踢掉某登录用户的方法" alt="centos 强制踢掉某登录用户的方法" src="https://zhuji.jb51.net/uploads/img/202305/27873ccf5f70b3059831ea1f6f493244.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
下面以需要踢掉root这个登录为例</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
因为他的tty是pts/1 所以输入pkill -kill -t pts/1然后确定</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
<img style="max-width:100%!important;height:auto!important;"title="centos 强制踢掉某登录用户的方法" alt="centos 强制踢掉某登录用户的方法" src="https://zhuji.jb51.net/uploads/img/202305/1db689d118b4aeedd0963f28a9ad216a.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
完成之后,我们再看一下,发现已经不在了 </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
<img style="max-width:100%!important;height:auto!important;"title="centos 强制踢掉某登录用户的方法" alt="centos 强制踢掉某登录用户的方法" src="https://zhuji.jb51.net/uploads/img/202305/01a2fcfafe818e11d1f8ede2e22b1c0f.jpg"></p>
頁:
[1]