This commit is contained in:
fofolee
2019-04-08 23:22:26 +08:00
commit 7ca94f1141
5960 changed files with 530244 additions and 0 deletions

37
docs/linux/lastb.html Normal file
View File

@@ -0,0 +1,37 @@
<h1 id="lastb">lastb</h1>
<p>列出登入系统失败的用户相关信息</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>lastb命令</strong> 用于显示用户错误的登录列表此指令可以发现系统的登录异常。单独执行lastb命令它会读取位于<code>/var/log</code>目录下名称为btmp的文件并把该文件内容记录的登入失败的用户名单全部显示出来。</p>
<h3 id="语法">语法</h3>
<pre><code>lastb(选项)(参数)</code></pre>
<h3 id="选项">选项</h3>
<pre><code>-a把从何处登入系统的主机名称或ip地址显示在最后一行
-d将IP地址转换成主机名称
-f&lt;记录文件&gt;:指定记录文件;
-n&lt;显示列数&gt;或-&lt;显示列数&gt;:设置列出名单的显示列数;
-R不显示登入系统的主机名称或IP地址
-x显示系统关机重新开机以及执行等级的改变等信息。</code></pre>
<h3 id="参数">参数</h3>
<ul>
<li>用户名:显示中的用户的登录列表;</li>
<li>终端:显示从指定终端的登录列表。</li>
</ul>
<h3 id="实例">实例</h3>
<p>首次运行lastb命令会报下的错误</p>
<pre><code>lastb: /var/log/btmp: No such file or directory
Perhaps this file was removed by the operator to prevent logging lastb info.</code></pre>
<p>只需建立这个不存在的文件即可。</p>
<pre><code>touch /var/log/btmp</code></pre>
<p>使用ssh的登录失败不会记录在btmp文件中。</p>
<pre><code>lastb | head
root ssh:notty 110.84.129.3 Tue Dec 17 06:19 - 06:19 (00:00)
root ssh:notty 110.84.129.3 Tue Dec 17 04:05 - 04:05 (00:00)
root ssh:notty 110.84.129.3 Tue Dec 17 01:52 - 01:52 (00:00)
root ssh:notty 110.84.129.3 Mon Dec 16 23:38 - 23:38 (00:00)
leonob ssh:notty 222.211.85.18 Mon Dec 16 22:18 - 22:18 (00:00)
leonob ssh:notty 222.211.85.18 Mon Dec 16 22:18 - 22:18 (00:00)
root ssh:notty 110.84.129.3 Mon Dec 16 21:25 - 21:25 (00:00)
root ssh:notty 110.84.129.3 Mon Dec 16 19:12 - 19:12 (00:00)
root ssh:notty 110.84.129.3 Mon Dec 16 17:00 - 17:00 (00:00)
admin ssh:notty 129.171.193.99 Mon Dec 16 16:52 - 16:52 (00:00)</code></pre>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->