\uff081\uff09\u65e5\u5fd7\u65f6\u957f<\/strong><\/span><\/div>\nbtmp\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>\nawk '{print $3}' \uff1a\u622a\u53d6lastb\u8f93\u51fa\u7684\u6570\u636e\u4e2d\u7684\u7b2c\u4e09\u5217\u4e5f\u5c31\u662fip\u5730\u5740\u3002<\/ol>\nsort \uff1a\u5c06ip\u5730\u5740\u8fdb\u884c\u5206\u7c7b\u3002<\/ol>\nuniq -c \uff1a\u5c06\u5206\u7c7b\u597d\u7684ip\u6570\u636e\u8fdb\u884c\u53bb\u91cd\u5e76\u8ba1\u6570\u3002<\/ol>\nsort -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>\nPS: \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>\nsecure\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}]}}