{"id":259030,"date":"2022-12-15T10:13:21","date_gmt":"2022-12-15T02:13:21","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=259030"},"modified":"2022-12-11T11:14:28","modified_gmt":"2022-12-11T03:14:28","slug":"linux-system-security-log","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-system-security-log.html","title":{"rendered":"Linux\u7cfb\u7edf\u5b89\u5168\u65e5\u5fd7\u8be6\u89e3"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u53ea\u8981\u5c06\u6211\u4eec\u7684\u670d\u52a1\u5668\u5728\u516c\u7f51\u73af\u5883\u516c\u5f00\uff0c\u63d0\u4f9b\u670d\u52a1\u3002\u5c31\u907f\u514d\u4e0d\u4e86\u6765\u81ea\u5168\u7403\u4e92\u8054\u7f51\u4e0a\u7684\u5404\u79cd\u653b\u51fb\u3002\u5927\u90e8\u5206\u7684\u653b\u51fb\u90fd\u662f\u4e00\u4e9b\u6cdb\u653b\u51fb\uff0c\u5229\u7528\u7a0b\u5e8f\u81ea\u52a8\u626b\u63cf\u5e76\u53d1\u8d77\u653b\u51fb\u800c\u5df2\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

1\u3001\u4ecb\u7ecd<\/strong><\/div>\n

Linux\u7cfb\u7edf\u63d0\u4f9b\u4e86\u5168\u65b9\u4f4d\u7684\u65e5\u5fd7\u8bb0\u5f55\u3002\u6211\u4eec\u767b\u5f55Linux\u7cfb\u7edf\u4e4b\u540e\u505a\u7684\u4e8b\u60c5Linux\u90fd\u6709\u76f8\u5e94\u7684\u65e5\u5fd7\u8bb0\u5f55\u3002\u6574\u4e2a\u65e5\u5fd7\u7cfb\u7edf\u6bd4\u8f83\u591a\u3002\u8fd9\u91cc\u53ea\u4ecb\u7ecd\u548c\u767b\u5f55\u6bd4\u8f83\u5bc6\u5207\u76f8\u5173\u7684\u4e09\u4e2a\u65e5\u5fd7\u3002<\/p>\n

secure\uff0cbtmp\u548cwtmp\u8fd9\u4e09\u4e2a\u65e5\u5fd7\u6587\u4ef6\u3002<\/p>\n

2\u3001wtmp\u65e5\u5fd7<\/strong><\/div>\n

\u9996\u5148\uff0c\u4ecb\u7ecdwtmp\u65e5\u5fd7\u6587\u4ef6\uff0c\u8be5\u6587\u4ef6\u8bb0\u5f55\u4e86\u6240\u6709\u7684\u767b\u5f55\u8fc7\u7cfb\u7edf\u7684\u7528\u6237\u4fe1\u606f\u3002\uff08PS\uff1a\u53ea\u8bb0\u5f55\u4e86\u6b63\u786e\u767b\u5f55\u7684\u7528\u6237\u3002\u5bc6\u7801\u9519\u8bef\u7b49\u5728btmp\u6587\u4ef6\u548csecure\u6587\u4ef6\u4e2d\uff09<\/p>\n

\u8be5\u6587\u4ef6\u7684\u5730\u5740\u8def\u5f84\u4e3a\uff1avar\/log\/wtmp \u3002wtmp\u6587\u4ef6\u662f\u4e00\u4e2a\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u65e0\u6cd5\u901a\u8fc7cat\u6216\u8005vim \u8fdb\u884c\u9605\u8bfb\u3002\u9700\u8981\u901a\u8fc7\u547d\u4ee4last\u8fdb\u884c\u9605\u8bfb\u3002<\/p>\n

\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n

[root@iZuf \/]# last -F\r\nroot     pts\/0        \u6211\u7684IP\u5730\u5740   Wed Nov 23 08:43:28 2022   still logged in\r\n...\r\nroot     pts\/0        \u6211\u7684IP\u5730\u5740   Wed Oct 19 16:00:28 2022 - Wed Oct 19 18:16:46 2022  (02:16)\r\nroot     pts\/0        \u6211\u7684IP\u5730\u5740   Wed Oct 19 09:51:51 2022 - Wed Oct 19 10:42:08 2022  (00:50)\r\n...\r\n<\/pre>\n

last \u547d\u540d\u4f1a\u9ed8\u8ba4\u4ecewtmp\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\u3002\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u4e0d\u7528\u6dfb\u52a0wtmp\u6587\u4ef6\u8def\u5f84\uff0c\u4f46\u662f\u5982\u679c\u4f7f\u7528 last -f \u5c31\u9700\u8981\u6211\u4eec\u4e3b\u52a8\u6dfb\u52a0wtmp\u8def\u5f84\u4e86\u3002<\/p>\n

\u4e0a\u9762\u7684\u6570\u636e\u5206\u522b\u662f\uff1a<\/p>\n

    \u767b\u5f55\u540d\uff1aroot\u3002<\/ol>\n
      \u6253\u5f00\u7684\u7ec8\u7aef\uff1apts\/0<\/ol>\n
        \u8bbf\u95ee\u8005IP\uff1a\u6211\u7684ip\u5730\u5740\uff08PS\uff1a\u5b9e\u9645ip \u662f\u663e\u793a 111,111,111,111\u683c\u5f0f\u7684\uff09<\/ol>\n
          \u767b\u5f55\u65f6\u95f4\uff1aTue Nov 15 11:17:40 2022<\/ol>\n
            \u9000\u51fa\u65f6\u95f4\uff1aTue Nov 15 13:14:02 2022<\/ol>\n
              \u8017\u65f6\uff1a(01:56) \u5982\u679c\u663e\u793astill logged in\u3002\u8868\u793a\u5f53\u524d\u4ecd\u7136\u5c5e\u4e8e\u767b\u5f55\u72b6\u6001\u3002<\/ol>\n

              \u5982\u679c\u6211\u4eec\u89c9\u5f97\u65e5\u671f\u663e\u793a\u9605\u8bfb\u4e0d\u76f4\u89c2\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4last --time-format \u8fdb\u884c\u65e5\u671f\u683c\u5f0f\u5316\u3002\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n

              [root@iZuf \/]# last --time-format iso\r\n...\r\nroot     pts\/0        \u6211\u7684IP\u5730\u5740     2020-08-07T17:05:19+08:00 - 2020-08-07T17:06:39+08:00  (00:01)\r\n<\/pre>\n

              \u65f6\u95f4\u5c06\u4f1a\u53d8\u6210\u6211\u4eec\u80fd\u591f\u76f4\u63a5\u9605\u8bfb\u7684\u683c\u5f0f\u3002\uff08PS\uff1a+08:00 \u53ea\u662f\u8bf4\u660e\u5f53\u524d\u65e5\u671f\u8fdb\u884c\u4e86\u65f6\u533a\u6dfb\u52a0\uff0c\u5e76\u4e0d\u4ee3\u8868\u6211\u4eec\u8fd8\u9700\u8981\u5728\u663e\u793a\u7684\u65f6\u95f4\u4e2d\u6dfb\u52a08\u5c0f\u65f6\u54e6\uff09<\/p>\n

              --time-format \u540e\u9762\u7684\u53ef\u9009\u53c2\u6570\u4e3a\uff1a<\/p>\n

                notime\uff1a \u4e0d\u663e\u793a\u65f6\u95f4\u3002\u793a\u4f8b\uff1a(13:34)\u3002\u53ea\u663e\u793a\u767b\u5f55\u65f6\u957f\u3002\u4e0d\u663e\u793a\u65f6\u95f4\u6bb5<\/ol>\n
                  short\uff1a\u77ed\u65f6\u95f4\u663e\u793a\u3002\u793a\u4f8b\uff1aFri Nov 4 17:53 - 18:03 (00:09)<\/ol>\n
                    full\uff1a\u6309\u7167\u9ed8\u8ba4\u683c\u5f0f\u663e\u793a\u5168\u90e8\u65f6\u95f4\u3002\u793a\u4f8b\uff1aTue Nov 22 13:48:22 2022 - Tue Nov 22 17:23:19 2022 (03:34)<\/ol>\n
                      iso\uff1a\u6309\u7167iso\u65f6\u95f4\u683c\u5f0f\u663e\u793a\u5168\u90e8\u65f6\u95f4\u3002\u793a\u4f8b\uff1a2020-08-07T17:05:19+08:00 - 2020-08-07T17:06:39+08:00 (00:01)<\/ol>\n

                      \u8fd9\u4e2a\u6587\u4ef6\u5c06\u4f1a\u8bb0\u5f55\u5168\u90e8\u7684\u767b\u5f55\u8bb0\u5f55\u3002\u5982\u679c\u4e2d\u95f4\u51fa\u73b0\u4e86\u4e0d\u5c5e\u4e8e\u6211\u4eec\u719f\u6089\u7684ip\u767b\u5f55\u3002\u90a3\u4e48\u8bf4\u660e\u8d26\u6237\u5bc6\u7801\u6709\u6cc4\u6f0f\u3002\u6216\u8005\u5176\u4ed6\u975e\u6cd5\u767b\u5f55\u4ea7\u751f\u3002<\/p>\n

                      PS\uff1a-F \u547d\u4ee4\u4e0d\u80fd\u548c--time-format \u4e00\u8d77\u4f7f\u7528\uff0c\u56e0\u4e3a\u5b83\u4eec\u4e24\u8005\u90fd\u5bf9\u8f93\u51fa\u7684\u65f6\u95f4\u683c\u5f0f\u6709\u5f71\u54cd\u3002<\/pre>\n
                      3\u3001btmp \u65e5\u5fd7<\/strong><\/div>\n

                      \u5982\u679c\u8bf4wtmp\u662f\u8bb0\u5f55\u767b\u5f55\u6210\u529f\u7684\u65e5\u5fd7\u3002\u90a3\u4e48btmp\u5c31\u662f\u8bb0\u5f55\u6240\u6709\u5c1d\u8bd5\u767b\u5f55\uff0c\u4f46\u662f\u767b\u5f55\u5931\u8d25\u7684\u65e5\u5fd7\u3002\u5b83\u5b58\u50a8\u7684\u8def\u5f84\u548cwtmp\u6587\u4ef6\u5728\u540c\u4e00\u76ee\u5f55\u4e0b\uff1a\/var\/log\/btmp<\/p>\n

                      \u540c\u6837btmp\u4e5f\u662f\u5c5e\u4e8e\u4e8c\u8fdb\u5236\u6587\u4ef6\u3002\u65e0\u6cd5\u901a\u8fc7cat\u6216\u8005vim \u8fdb\u884c\u9605\u8bfb\u3002\u9700\u8981\u901a\u8fc7\u547d\u4ee4lastb\u8fdb\u884c\u9605\u8bfb\u3002<\/p>\n

                      last\uff1a \u9605\u8bfb\u7684wtmp\u6587\u4ef6\r\nlastb\uff1a\u9605\u8bfb\u7684btmp\u6587\u4ef6\r\n\u8fd9\u4e24\u4e2a\u6307\u4ee4\u662f\u6709\u4e00\u4e2a\u5b57\u6bcd\u7684\u533a\u522b\u3002\u5343\u4e07\u4e0d\u8981\u5f04\u6df7\u4e86\r\n<\/pre>\n

                      \u8fd9\u4e24\u4e2a\u547d\u4ee4\u7684 \u53c2\u6570\u53ef\u4ee5\u8bf4\u662f\u5b8c\u5168\u4e00\u6837\u3002\u53ef\u4ee5\u7528\u4e8elast\u7684\u4e5f\u53ef\u4ee5\u7528\u4e8elastb\u3002<\/p>\n

                      lastb\u7684\u547d\u4ee4\u53c2\u6570\u5982\u4e0b\uff1a<\/p>\n

                        - \uff1a\u8981\u663e\u793a\u591a\u5c11\u884c<\/ol>\n
                          -a, --hostlast \uff1a\u5728\u6700\u540e\u4e00\u5217\u4e2d\u663e\u793a\u4e3b\u673a\u540d<\/ol>\n
                            -d, --dns \uff1a\u5c06IP\u5730\u5740\u8f6c\u6362\u56de\u4e3b\u673a\u540d<\/ol>\n
                              -f \uff1a\u4f7f\u7528\u7279\u5b9a\u6587\u4ef6\u800c\u4e0d\u662f\/var\/log\/btmp<\/ol>\n
                                -F, --fulltimes \uff1a\u6253\u5370\u5b8c\u6574\u7684\u767b\u5f55\u548c\u6ce8\u9500\u65f6\u95f4\u548c\u65e5\u671f<\/ol>\n
                                  -i, --ip \uff1a\u4ee5\u6570\u5b57\u548c\u70b9\u8868\u793a\u6cd5\u663e\u793aIP\u53f7\u7801<\/ol>\n
                                    -n, --limit \uff1a\u8981\u663e\u793a\u591a\u5c11\u884c<\/ol>\n
                                      -R, --nohostname \uff1a\u4e0d\u663e\u793a\u4e3b\u673a\u540d\u5b57\u6bb5<\/ol>\n
                                        -s, --since\u300atime\u300b\uff1a\u663e\u793a\u6307\u5b9a\u65f6\u95f4\u4e4b\u540e\u7684\u884c \uff08\u67e5\u8be2\u6307\u5b9a\u65f6\u95f4\u4e4b\u540e\u7684\u8bb0\u5f55\uff09<\/ol>\n
                                          \n<\/ol>\n
                                            -t, --until\u300atime\u300b \uff1a\u663e\u793a\u6307\u5b9a\u65f6\u95f4\u4e4b\u524d\u7684\u884c \uff08\u67e5\u8be2\u6307\u5b9a\u65f6\u95f4\u4e4b\u524d\u7684\u8bb0\u5f55\uff09<\/ol>\n
                                              -p, --present\u300atime\u300b \uff1a\u663e\u793a\u5728\u6307\u5b9a\u65f6\u95f4\u5185\u5728\u573a\u7684\u8d26\u6237<\/ol>\n
                                                -w, --fullnames \uff1a\u663e\u793a\u5b8c\u6574\u7684\u7528\u6237\u540d\u548c\u57df\u540d<\/ol>\n
                                                  -x, --system \uff1a\u663e\u793a\u7cfb\u7edf\u5173\u95ed\u6761\u76ee\u548c\u8fd0\u884c\u7ea7\u522b\u66f4\u6539<\/ol>\n
                                                    --time-format \uff1a\u663e\u793a\u6307\u5b9a\u683c\u5f0f\u7684\u65f6\u95f4\u6233 : notime|short|full|iso<\/ol>\n
                                                    PS\uff1a-F \u547d\u4ee4\u4e0d\u80fd\u548c--time-format \u4e00\u8d77\u4f7f\u7528\uff0c\u56e0\u4e3a\u5b83\u4eec\u4e24\u8005\u90fd\u5bf9\u8f93\u51fa\u7684\u65f6\u95f4\u683c\u5f0f\u6709\u5f71\u54cd\u3002<\/pre>\n

                                                    \u5177\u4f53\u4f7f\u7528\u793a\u4f8b\uff1a\uff08PS\uff1a\u7531\u4e8e\u5185\u5bb9\u6bd4\u8f83\u591a\uff0c\u5c31\u5148\u663e\u793a10\u6761\u8bb0\u5f55\u4e86\uff09<\/p>\n

                                                    [root@iZuf \/]# lastb -10\r\nliu      ssh:notty    170.64.132.128   Wed Nov 23 07:40 - 07:40  (00:00)\r\nsine     ssh:notty    170.64.132.128   Wed Nov 23 07:40 - 07:40  (00:00)\r\nftpUser  ssh:notty    170.64.132.128   Wed Nov 23 07:40 - 07:40  (00:00)\r\nsine     ssh:notty    170.64.132.128   Wed Nov 23 07:40 - 07:40  (00:00)\r\nliu      ssh:notty    170.64.132.128   Wed Nov 23 07:40 - 07:40  (00:00)\r\nchenms   ssh:notty    170.64.132.128   Wed Nov 23 07:40 - 07:40  (00:00)\r\nmingjian ssh:notty    170.64.132.128   Wed Nov 23 07:40 - 07:40  (00:00)\r\nliu      ssh:notty    170.64.132.128   Wed Nov 23 07:40 - 07:40  (00:00)\r\nsine     ssh:notty    170.64.132.128   Wed Nov 23 07:40 - 07:40  (00:00)\r\nftpUser  ssh:notty    170.64.132.128   Wed Nov 23 07:40 - 07:40  (00:00)\r\n<\/pre>\n

                                                    \u683c\u5f0f\u8868\u73b0\u4e3a\uff1a<\/p>\n

                                                    \u7b2c\u4e00\u5217\u663e\u793a\u767b\u5f55\u540d\uff0c\u7b2c\u4e8c\u5217\u663e\u793a\u767b\u5f55ssh\u65b9\u5f0f\u5f88\u660e\u663e ssh:notty\u662f\u5728\u4f7f\u7528\u66b4\u529b\u7834\u89e3ssh\u5bc6\u7801\u3002\uff08\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48Linux\u5efa\u8bae\u4e00\u6bb5\u65f6\u95f4\u5185\u8ddf\u6362\u5bc6\u7801\u7684\u539f\u56e0\uff0c\u5f53\u7136\u4f7f\u7528\u79d8\u94a5\u7684\u5b89\u5168\u6027\u8981\u6bd4\u5bc6\u7801\u9ad8\u4e0d\u5c11\u3002\uff09\uff0c\u7b2c\u4e09\u5217\u663e\u793a\u7684\u5c31\u662f\u8bbf\u95ee\u8005IP\u5730\u5740\u4e86\u3002 \u4e4b\u540e\u7684\u5c31\u662f\u65f6\u95f4\u548c\u8017\u8d39\u65f6\u957f\u4e86\u3002<\/p>\n

                                                    \u793a\u4f8b,\u5c06\u65f6\u95f4\u6233\u8fdb\u884c\u5e8f\u5217\u5316\u540e\u663e\u793a\u5982\u4e0b\uff1a<\/p>\n

                                                    [root@iZuf \/]# lastb -10 --time-format iso\r\nliu      ssh:notty    170.64.132.128   2022-11-23T07:40:24+08:00 - 2022-11-23T07:40:24+08:00  (00:00)\r\nsine     ssh:notty    170.64.132.128   2022-11-23T07:40:24+08:00 - 2022-11-23T07:40:24+08:00  (00:00)\r\nftpUser  ssh:notty    170.64.132.128   2022-11-23T07:40:23+08:00 - 2022-11-23T07:40:23+08:00  (00:00)\r\nsine     ssh:notty    170.64.132.128   2022-11-23T07:40:23+08:00 - 2022-11-23T07:40:23+08:00  (00:00)\r\nliu      ssh:notty    170.64.132.128   2022-11-23T07:40:22+08:00 - 2022-11-23T07:40:22+08:00  (00:00)\r\nchenms   ssh:notty    170.64.132.128   2022-11-23T07:40:22+08:00 - 2022-11-23T07:40:22+08:00  (00:00)\r\nmingjian ssh:notty    170.64.132.128   2022-11-23T07:40:22+08:00 - 2022-11-23T07:40:22+08:00  (00:00)\r\nliu      ssh:notty    170.64.132.128   2022-11-23T07:40:21+08:00 - 2022-11-23T07:40:21+08:00  (00:00)\r\nsine     ssh:notty    170.64.132.128   2022-11-23T07:40:21+08:00 - 2022-11-23T07:40:21+08:00  (00:00)\r\nftpUser  ssh:notty    170.64.132.128   2022-11-23T07:40:21+08:00 - 2022-11-23T07:40:21+08:00  (00:00)\r\n<\/pre>\n
                                                    \uff081\uff09\u65e5\u5fd7\u65f6\u957f<\/strong><\/span><\/div>\n

                                                    btmp\u65e5\u5fd7\u7531\u4e8e\u5185\u5bb9\u8fc7\u591a\u3002\u5b83\u4f1a\u630930\u5929\u8fdb\u884c\u5907\u4efd\u4e00\u6b21\u6570\u636e\u3002\u53ea\u4f1a\u5907\u4efd\u4e00\u4e2a\u6708\u7684\u6570\u636e\u3002<\/p>\n

                                                    \u5907\u4efd\u6587\u4ef6\u548cbtmp\u6587\u4ef6\u5b58\u50a8\u5728\u540c\u4e00\u76ee\u5f55\u4e0b\uff0c\u53ea\u662f\u547d\u540d\u540e\u9762\u8ffd\u52a0\u4e0a\u5907\u4efd\u521b\u5efa\u65e5\u671f\u800c\u5df2\u3002\u793a\u4f8b\uff1a<\/p>\n

                                                    \u5c0f\u6280\u5de7\uff1a\u5728Linux\u7cfb\u7edf\u4e2d\u586b\u5199\u8def\u5f84\u65f6\u6309Tab\u5c06\u4f1a\u8865\u5168\uff0c\u5982\u679c\u65e0\u6cd5\u8865\u5168\u8bf4\u660e\u6709\u591a\u4e2a\u5019\u9009\u9879\uff0c\u6211\u4eec\u53cc\u51fbTab\u5c06\u4f1a\u5217\u51fa\u5168\u90e8\u5019\u9009\u9879\u3002<\/p>\n

                                                    [root@iZuf \/]# ls var\/log\/btmp\r\nbtmp           btmp-20221101  \r\n<\/pre>\n

                                                    \u4f8b\u5982\u4e0a\u9762\u7684\u7ed3\u679c\uff0c\u6211\u4eec\u5982\u679c\u8981\u770bbtmp-20221101 \u91cc\u9762\u7684\u6570\u636e\uff0c\u5c31\u9700\u8981\u4f7f\u7528\uff1alastb -f \/var\/log\/btmp-20221101<\/p>\n

                                                    \u793a\u4f8b\u5982\u4e0b\uff0c\u67e5\u8be2\u4e0a\u4e2a\u6708\u7684\u975e\u6cd5\u767b\u5f55\u7684\u524d10\u6761\u8bb0\u5f55\uff1a<\/p>\n

                                                    [root@iZuf \/]# lastb -f \/var\/log\/btmp-20221101 -10\r\nsine     ssh:notty    143.244.141.68   Sat Oct 29 22:02 - 22:02  (00:00)\r\nliu      ssh:notty    143.244.141.68   Sat Oct 29 22:02 - 22:02  (00:00)\r\nsine     ssh:notty    143.244.141.68   Sat Oct 29 22:02 - 22:02  (00:00)\r\nsine     ssh:notty    143.244.141.68   Sat Oct 29 22:02 - 22:02  (00:00)\r\nwjquan   ssh:notty    143.244.141.68   Sat Oct 29 22:02 - 22:02  (00:00)\r\nliu      ssh:notty    143.244.141.68   Sat Oct 29 22:02 - 22:02  (00:00)\r\nzkkj     ssh:notty    143.244.141.68   Sat Oct 29 22:02 - 22:02  (00:00)\r\nchenms   ssh:notty    143.244.141.68   Sat Oct 29 22:02 - 22:02  (00:00)\r\nmingjian ssh:notty    143.244.141.68   Sat Oct 29 22:02 - 22:02  (00:00)\r\nmingjian ssh:notty    143.244.141.68   Sat Oct 29 22:02 - 22:02  (00:00)\r\n<\/pre>\n

                                                    \u5982\u679c\u975e\u6cd5\u767b\u5f55\u7684\u6570\u636e\u6587\u4ef6\u6bd4\u8f83\u5927\uff0c\u6211\u4eec\u600e\u4e48\u8fdb\u884c\u67e5\u8be2\u5462\uff1fLinux\u53ef\u4ee5\u9488\u5bf9\u6570\u636e\u8fdb\u884c\u7b5b\u9009<\/p>\n

                                                    \uff082\uff09\u7edf\u8ba1ip\u767b\u5f55\u6b21\u6570<\/strong><\/span><\/div>\n

                                                    \u6076\u610f\u8bbf\u95ee\u6570\u636e\u8fc7\u591a\u7684\u65f6\u5019\uff0c\u6211\u4eec\u901a\u8fc7lastb\u76f4\u63a5\u9605\u8bfb\u6bd4\u8f83\u56f0\u96be\u56e0\u4e3a\u6570\u636e\u8f83\u5927\u3002\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u5c31\u53ef\u4ee5\u901a\u8fc7\u5bf9\u67e5\u8be2\u7ed3\u679c\u8fdb\u884c\u7b5b\u9009\u3002<\/p>\n

                                                    \u4f8b\u5982\uff1a<\/p>\n

                                                    [root@iZuf \/]# lastb | awk '{ print $3}' | sort | uniq -c | sort -n\r\n      5 98.143.158.42\r\n   5368 143.244.137.83\r\n   5402 170.64.132.120\r\n   5522 170.64.132.128\r\n   6212 193.47.61.21\r\n<\/pre>\n

                                                    \u4e0a\u8ff0\u663e\u793a\u7ed3\u679c\uff0c\u7b2c\u4e00\u5217ip\u5730\u5740\u7684\u767b\u5f55\u6b21\u6570\uff0c\u7b2c\u4e8c\u5217\u4e3aip\u5730\u5740\u3002\u6211\u4eec\u53ef\u4ee5\u5bf9\u767b\u5f55\u8fc7\u5927\u7684ip\u8fdb\u884c\u5c01\u7981\u64cd\u4f5c\u3002<\/p>\n

                                                    \u4e0b\u9762\u8fdb\u884c\u547d\u4ee4\u62c6\u5206\u4ecb\u7ecd\u3002\u5728Linux\u4e2d\u901a\u8fc7|\u7b26\u53f7\u5bf9\u547d\u4ee4\u8fdb\u884c\u62c6\u5206\u3002<\/p>\n

                                                    \u4e0a\u8ff0\u7684\u547d\u4ee4\u5176\u5b9e\u5c31\u662f\uff1a<\/p>\n

                                                      lastb \uff1a \u901a\u8fc7lastb\u547d\u4ee4\u4f1a\u62c9\u53d6\u5168\u90e8\u7684\u975e\u6cd5\u767b\u5f55\u65e5\u5fd7\u3002<\/ol>\n
                                                        awk '{print $3}' \uff1a\u622a\u53d6lastb\u8f93\u51fa\u7684\u6570\u636e\u4e2d\u7684\u7b2c\u4e09\u5217\u4e5f\u5c31\u662fip\u5730\u5740\u3002<\/ol>\n
                                                          sort \uff1a\u5c06ip\u5730\u5740\u8fdb\u884c\u5206\u7c7b\u3002<\/ol>\n
                                                            uniq -c \uff1a\u5c06\u5206\u7c7b\u597d\u7684ip\u6570\u636e\u8fdb\u884c\u53bb\u91cd\u5e76\u8ba1\u6570\u3002<\/ol>\n
                                                              sort -n \uff1a \u5c06\u5206\u7c7b\u53bb\u91cd\u5e76\u8ba1\u6570\u7684\u6570\u636e\uff0c\u8fdb\u884c\u5206\u7c7b\u5e76\u4e14\u6309\u7167\u6570\u503c\u8fdb\u884c\u4ece\u5c0f\u5230\u5927\u6392\u5e8f\u3002<\/ol>\n

                                                              \u4f8b\u5982\u6211\u4eec\u5982\u679c\u8981\u67e5\u4e0a\u4e00\u4e2a\u6708\u7684\u975e\u6cd5\u767b\u5f55\u6b21\u6570\u7edf\u8ba1\uff1a<\/p>\n

                                                              [root@iZuf \/]# lastb -f \/var\/log\/btmp-20221101 | awk '{ print $3}' | sort | uniq -c | sort -n\r\n     51 157.230.21.85\r\n   4861 167.71.234.209\r\n   5038 143.244.141.68\r\n   5202 143.244.129.121\r\n   5262 167.71.226.83\r\n<\/pre>\n

                                                              PS: \u5982\u679c\u60f3\u9ad8\u6548\u63a7\u5236\u548c\u9632\u8303\uff0c\u90a3\u4e48\u4f7f\u7528\u9632\u706b\u5899\u53ef\u4ee5\u8bf4\u662f\u6700\u4f73\u9009\u62e9\u4e86\u3002\u53ef\u4ee5\u4f7f\u7528\u963f\u91cc\u4e91\u63d0\u4f9b\u7684\u4e91\u9632\u706b\u5899\uff0c\u5305\u62ec\u7ed3\u5408\u60c5\u62a5\u7684\u5b9e\u65f6\u5165\u4fb5\u9632\u62a4\u3001\u5168\u6d41\u91cf\u53ef\u89c6\u5316\u5206\u6790\u3001\u667a\u80fd\u5316\u8bbf\u95ee\u63a7\u5236\u3001\u65e5\u5fd7\u6eaf\u6e90\u5206\u6790\u7b49\u80fd\u529b\u3002<\/p>\n

                                                              4\u3001secure \u65e5\u5fd7<\/strong><\/div>\n

                                                              \u76f8\u8f83\u4e8ewtmp\u6587\u4ef6\u548cbtmp\u6587\u4ef6\uff0csecure\u65e5\u5fd7\u5c31\u662f\u4e00\u4e2a\u6587\u672c\u3002\u53ef\u4ee5\u901a\u8fc7vim\u6216\u8005cat\u9605\u8bfb\u3002\u4e5f\u53ef\u4ee5\u5bfc\u51fa\u5230windows\u73af\u5883\u4e0b\u4f7f\u7528VSCode\u6216\u8005\u6587\u672c\u6587\u6863\u7b49\u9605\u8bfb\u3002<\/p>\n

                                                              secure\u65e5\u5fd7\u548cwtmp\u548cbtmp\u6587\u4ef6\u4e00\u6837\uff0c\u5b58\u50a8\u5728var\/log\u76ee\u5f55\u4e0b\u3002\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n

                                                              [root@iZuf \/]# ls \/var\/log\/secure\r\nsecure           secure-20221030  secure-20221106  secure-20221113  secure-20221120 \r\n<\/pre>\n

                                                              secure\u6587\u4ef6\u662f\u6309\u7167\u6bcf7\u5929\u5907\u4efd\u4e00\u6b21\u7684\u9891\u7387\uff0c\u8fdb\u884c\u5907\u4efd\u7684\u3002\u6587\u6863\u6253\u5f00\u540e\u7684\u5185\u5bb9\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n

                                                              Nov 20 09:25:19 iZuf sshd[2322424]: error: kex_exchange_identification: banner line contains invalid characters\r\nNov 20 12:55:16 iZuf sshd[2323018]: error: kex_exchange_identification: Connection closed by remote host\r\nNov 20 12:58:27 iZuf sshd[2323024]: Invalid user amax from 170.64.132.120 port 47146\r\nNov 20 12:58:28 iZuf sshd[2323026]: Invalid user amax from 170.64.132.120 port 47158\r\nNov 20 12:58:28 iZuf sshd[2323024]: pam_unix(sshd:auth): check pass; user unknown\r\nNov 20 12:58:28 iZuf sshd[2323024]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=170.64.132.120\r\nNov 20 12:58:28 iZuf sshd[2323026]: pam_unix(sshd:auth): check pass; user unknown\r\nNov 20 12:58:28 iZuf sshd[2323026]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=170.64.132.120\r\nNov 20 12:58:28 iZuf sshd[2323028]: Invalid user amax from 170.64.132.120 port 47164\r\nNov 20 12:58:28 iZuf sshd[2323030]: Invalid user amax from 170.64.132.120 port 47178\r\nNov 20 12:58:28 iZuf sshd[2323028]: pam_unix(sshd:auth): check pass; user unknown\r\nNov 20 12:58:28 iZuf sshd[2323028]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=170.64.132.120\r\nNov 20 12:58:28 iZuf sshd[2323032]: Invalid user amax from 170.64.132.120 port 47188\r\nNov 20 12:58:29 iZuf sshd[2323030]: pam_unix(sshd:auth): check pass; user unknown\r\nNov 20 12:58:29 iZuf sshd[2323030]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=170.64.132.120\r\nNov 20 12:58:29 iZuf sshd[2323032]: pam_unix(sshd:auth): check pass; user unknown\r\n<\/pre>\n

                                                              \u76f8\u8f83\u4e8ewtmp\u548cbtmp\u4e00\u4e2a\u8bb0\u5f55\u6210\u529f\u7684\uff0c\u4e00\u4e2a\u8bb0\u5f55\u5931\u8d25\u7684\u3002secure\u65e5\u5fd7\u8bb0\u5f55\u6574\u4e2a\u767b\u5f55\u8fc7\u7a0b\u7684\u6240\u6709\u6570\u636e\uff0c\u4e0d\u7ba1\u6210\u529f\u8fd8\u662f\u5931\u8d25\u90fd\u4f1a\u8fdb\u884c\u8bb0\u5f55\u3002<\/p>\n

                                                              PS\uff1a\u7531\u4e8esecure\u65e5\u5fd7\u5c5e\u4e8e\u6587\u6863\u7c7b\u578b\u7684\uff0c\u90a3\u4e48\u767b\u5f55\u6210\u529f\u540e\u7684\u975e\u6cd5\u767b\u5f55\u5b83\u662f\u53ef\u4ee5\u6bd4\u8f83\u65b9\u4fbf\u7684\u5bf9secure\u6587\u4ef6\u8fdb\u884c\u7be1\u6539\u7684\u3002<\/p>\n

                                                              \u4e0b\u9762\u7b80\u5355\u5217\u4e00\u4e9b\u51fa\u73b0\u7684\u5404\u79cd\u9519\u8bef\u548c\u6210\u529f\u65e5\u5fd7\uff1a<\/p>\n

                                                              \u8bbf\u95ee\u6210\u529f\u540e\u7684\u65e5\u5fd7\uff1aAccepted password for root from \u6211\u7684\u771f\u5b9eIP port \u7aef\u53e3\u53f7 ssh2
                                                              \n\u6307\u4ee4\u4e0e\u7aef\u53e3\u4e0d\u5339\u914d: \u4fee\u6539\u4e86\u9ed8\u8ba4\u7684SSH\u7aef\u53e3\uff0822\uff09 \u6539\u4e3a\u5176\u4ed6\u7aef\u53e3\u4e86\u3002\u653b\u51fb\u8005\u8bbf\u95ee\u8be5\u7aef\u53e3\u65f6\uff0c\u547d\u4ee4\u548c\u7aef\u53e3\u670d\u52a1\u4e0d\u5339\u914d\u5c31\u4f1a\u51fa\u73b0\u4e0b\u9762\u7684\u9519\u8bef\u65e5\u5fd7\u8bb0\u5f55\u3002
                                                              \nerror: kex_exchange_identification: banner line contains invalid characters\u3002
                                                              \nip\u5730\u5740\u4e3a170.64.132.120 \u7684\u4e3b\u673a\u5c1d\u8bd5\u7834\u89e3sshd\u767b\u5f55\uff1a\u5b83\u4f7f\u7528\u4e86\u65b0\u7684\u8d26\u6237\u548c\u5bc6\u7801\u8fdb\u884c\u9a8c\u8bc1\u3002
                                                              \npam_unix(sshd:auth): check pass; user unknown
                                                              \npam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=170.64.132.120\u3002
                                                              \n\u63d0\u793a\u6765\u81ea\u4e8e170.64.132.120 \u4e3b\u673a\u7684\u7aef\u53e3 47146\u7684\u8bf7\u6c42\uff0c\u7528\u6237\u540d\u65e0\u6548\u3002\u4e0d\u5141\u8bb8\u64cd\u4f5c\uff1aInvalid user amax from 170.64.132.120 port 47146\u3002
                                                              \n\u4e3a\u6b63\u786e\u7528\u6237\u5f00\u542froot\u4f1a\u8bdd\uff0c\u4e5f\u5c31\u662f\u8fdc\u7a0b\u767b\u5f55\u7684\u547d\u4ee4\u8f93\u5165\u754c\u9762\uff1apam_unix(sshd:session): session opened for user root by (uid=0)\u3002
                                                              \n\u4e3a\u7528\u6237\u5173\u95edroot\u4f1a\u8bdd \u4e5f\u5c31\u662f\u547d\u4ee4\u884c\u8f93\u5165\u754c\u9762\uff1apam_unix(sshd:session): session closed for user root\u3002
                                                              \n\u6765\u81ea\u7528\u6237\u540djason\u7684\u767b\u5f55\uff0c\u5bc6\u7801\u548c\u7528\u6237\u9a8c\u8bc1\u5931\u8d25\uff1aFailed password for invalid user jason from 170.64.132.128 port 59676 ssh2\u3002
                                                              \n\u7b49\u7b49\u8fd8\u6709\u5f88\u591a\u7684\u547d\u4ee4\u65e5\u5fd7\u3002<\/p>\n

                                                              \u53ea\u8981\u6211\u4eec\u7684\u670d\u52a1\u5668\u5f00\u542f\u4e86SSH\uff0c\u90a3\u4e48\u8fd9\u79cd\u653b\u51fb\u5c31\u4f1a\u518d\u6240\u96be\u514d\u3002\u6211\u4eec\u9700\u8981<\/p>\n

                                                              \u4fee\u6539\u9ed8\u8ba4\u7684ssh\u7684\u7aef\u53e322\u6539\u4e3a\u5176\u4ed6\u7684\u7aef\u53e3\uff0c\u53ef\u4ee5\u63d0\u9ad8\u5b89\u5168\u6027\u3002
                                                              \nroot\u5bc6\u7801\u8bbe\u7f6e\u6bd4\u8f83\u590d\u6742\u7684\u5bc6\u7801\uff0c\u5e76\u4e14\u4fdd\u6301\u66f4\u65b0\u3002
                                                              \n\u4f7f\u7528\u79d8\u94a5\u9a8c\u8bc1\u6bd4\u5bc6\u7801\u9a8c\u8bc1\u5b89\u5168\u6027\u66f4\u9ad8\u3002
                                                              \n\u4f7f\u7528\u9632\u706b\u5899\u5c4f\u853d\u5927\u91cf\u8bbf\u95ee\u7684ip\u3002
                                                              \n\u4f7f\u7528\u811a\u672c\uff0c\u5bf9\u653b\u51fb\u8bbf\u95ee\u8fdb\u884c\u81ea\u52a8\u62c9\u9ed1\u6dfb\u52a0\u5230\u5c4f\u853d\u8bbf\u95ee\u7684\u6587\u4ef6\u4e2d\u3002<\/p>\n

                                                              5\u3001\u603b\u7ed3<\/strong><\/div>\n

                                                              \u53ea\u8981\u5c06\u6211\u4eec\u7684\u670d\u52a1\u5668\u5728\u516c\u7f51\u73af\u5883\u516c\u5f00\uff0c\u63d0\u4f9b\u670d\u52a1\u3002\u5c31\u907f\u514d\u4e0d\u4e86\u6765\u81ea\u5168\u7403\u4e92\u8054\u7f51\u4e0a\u7684\u5404\u79cd\u653b\u51fb\u3002\u5927\u90e8\u5206\u7684\u653b\u51fb\u90fd\u662f\u4e00\u4e9b\u6cdb\u653b\u51fb\uff0c\u5229\u7528\u7a0b\u5e8f\u81ea\u52a8\u626b\u63cf\u5e76\u53d1\u8d77\u653b\u51fb\u800c\u5df2\u3002<\/p>\n

                                                              \u66f4\u591a\u7684\u9488\u5bf9\u7684\u90fd\u662f\u4e00\u4e9b\u5f31\u5bc6\u7801\u4f8b\u5982123456\uff0cadmin\u7b49\u7684\u81ea\u52a8\u653b\u51fb\u811a\u672c\u3002<\/p>\n

                                                              \u6211\u4eec\u53ea\u9700\u8981\u7ed9\u81ea\u5df1\u7684\u670d\u52a1\u5668\u521b\u5efa\u590d\u6742\u7a0b\u5ea6\u9ad8\u7684\u5bc6\u7801\uff0c\u5e76\u4fdd\u6301\u4e00\u6bb5\u65f6\u95f4\u7684\u5bc6\u7801\u8ddf\u6362\u3002\u540c\u65f6\u5982\u679c\u5fc5\u987b\u4f7f\u7528SSH\u767b\u5f55\u5c31\u5c06\u9ed8\u8ba4\u7aef\u53e322\u66f4\u6362\u4e3a\u5176\u4ed6\u7aef\u53e3\u3002\u200b\u200b\u200b\u200b<\/p>\n

                                                              \u7136\u540e\u4e00\u6bb5\u65f6\u95f4\u540e\uff0c\u9488\u5bf9\u5927\u91cf\u91cd\u590d\u7684ip\u5730\u5740\u8fdb\u884c\u5c01\u7981\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

                                                              Linux\u7cfb\u7edf\u63d0\u4f9b\u4e86\u5168\u65b9\u4f4d\u7684\u65e5\u5fd7\u8bb0\u5f55\u3002\u6211\u4eec\u767b\u5f55Linux\u7cfb\u7edf\u4e4b\u540e\u505a\u7684\u4e8b\u60c5Linux\u90fd\u6709\u76f8\u5e94\u7684\u65e5\u5fd7\u8bb0\u5f55\u3002\u6574\u4e2a\u65e5\u5fd7 […]<\/p>\n","protected":false},"author":1329,"featured_media":259033,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-259030","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/259030","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1329"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=259030"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/259030\/revisions"}],"predecessor-version":[{"id":259036,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/259030\/revisions\/259036"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/259033"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=259030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=259030"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=259030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}