{"id":278753,"date":"2023-07-26T20:08:04","date_gmt":"2023-07-26T12:08:04","guid":{"rendered":"https:\/\/lrxjmw.cn\/lqszksyyh.html"},"modified":"2023-07-26T20:08:04","modified_gmt":"2023-07-26T12:08:04","slug":"lqszksyyh","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lqszksyyh.html","title":{"rendered":"Linux\u8f7b\u677e\u67e5\u770b\u6240\u6709\u7528\u6237"},"content":{"rendered":"

Linux<\/a>\u7cfb\u7edf<\/a>\u4f5c\u4e3a\u4e00\u79cd\u5f00\u6e90\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8e\u5404\u79cd\u9886\u57df\u3002\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u4e86\u89e3\u548c\u7ba1\u7406\u7528\u6237\u662f\u975e\u5e38\u91cd\u8981\u7684\u4e00\u9879\u4efb\u52a1\u3002\u672c\u6587\u5c06\u5206\u4eab\u5982\u4f55\u4f7f\u7528Linux\u547d\u4ee4<\/a>\u6765\u67e5\u770b\u6240\u6709\u7528\u6237\u7684\u65b9\u6cd5\u548c\u6280\u5de7\uff0c\u5e2e\u52a9\u8bfb\u8005\u66f4\u597d\u5730\u7ba1\u7406\u548c\u4e86\u89e3\u7cfb\u7edf\u4e2d\u7684\u7528\u6237\u4fe1\u606f\u3002<\/p>\n

1.\u4f7f\u7528\u201ccat \/etc\/passwd\u201d\u547d\u4ee4<\/p>\n

\u7b2c\u4e00\u79cd\u67e5\u770b\u6240\u6709\u7528\u6237\u7684\u65b9\u6cd5\u662f\u4f7f\u7528\u201ccat \/etc\/passwd\u201d\u547d\u4ee4\u3002\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u663e\u793a\u7cfb\u7edf\u4e2d\u6240\u6709\u7528\u6237\u7684\u4fe1\u606f\uff0c\u5305\u62ec\u7528\u6237\u540d\u3001\u7528\u6237ID\u3001\u7ec4ID\u3001\u7528\u6237\u5bb6\u76ee\u5f55\u7b49\u3002\u6211\u4eec\u53ef\u4ee5\u5c06\u7ed3\u679c\u5bfc\u51fa\u5230\u4e00\u4e2a\u6587\u4ef6\u4e2d\uff0c\u4ee5\u4fbf\u540e\u7eed\u67e5\u770b\u548c\u5206\u6790\u3002<\/p>\n

\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n

\n

bash\n   cat \/etc\/passwd > users.txt\n   <\/pre>\n<\/p>\n

2.\u4f7f\u7528\u201ccut -d:-f1 \/etc\/passwd\u201d\u547d\u4ee4<\/p>\n

\u7b2c\u4e8c\u79cd\u65b9\u6cd5\u662f\u4f7f\u7528\u201ccut -d:-f1 \/etc\/passwd\u201d\u547d\u4ee4\u3002\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u622a\u53d6\/etc\/passwd\u6587\u4ef6\u4e2d\u7684\u7b2c\u4e00\u4e2a\u5b57\u6bb5\uff0c\u5e76\u4ee5\u6b64\u663e\u793a\u6240\u6709\u7528\u6237\u7684\u7528\u6237\u540d\u3002\u8fd9\u6837\u53ef\u4ee5\u66f4\u52a0\u7b80\u6d01\u5730\u5217\u51fa\u6240\u6709\u7528\u6237\u3002<\/p>\n

\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n

\n

bash\n   cut -d:-f1 \/etc\/passwd\n   <\/pre>\n<\/p>\n

3.\u4f7f\u7528\u201cgetent passwd\u201d\u547d\u4ee4<\/p>\n

linux\u67e5\u770b\u6240\u6709\u7528\u6237_\u67e5\u770b\u7528\u6237\u4e34\u65f6\u8868\u7a7a\u95f4_\u67e5\u770b\u7528\u6237\u534f\u8bae<\/p>\n

\u7b2c\u4e09\u79cd\u65b9\u6cd5\u662f\u4f7f\u7528\u201cgetent passwd\u201d\u547d\u4ee4\u3002\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u4ece\u7cfb\u7edf\u6570\u636e\u5e93\u4e2d\u83b7\u53d6\u7528\u6237\u4fe1\u606flinux\u67e5\u770b\u6240\u6709\u7528\u6237<\/strong>\uff0c\u5e76\u663e\u793a\u6240\u6709\u7528\u6237\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u7528\u6237\u540d\u3001\u7528\u6237ID\u3001\u7ec4ID\u3001\u7528\u6237\u5bb6\u76ee\u5f55\u7b49\u3002\u6b64\u547d\u4ee4\u8fd8\u53ef\u4ee5\u7528\u4e8e\u67e5\u8be2\u7279\u5b9a\u7528\u6237\u7684\u4fe1\u606f\u3002<\/p>\n

\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n

\n

bash\n   getent passwd\n   <\/pre>\n<\/p>\n

4.\u4f7f\u7528\u201cawk -F:'{ print $1}'\/etc\/passwd\u201d\u547d\u4ee4<\/p>\n

\u7b2c\u56db\u79cd\u65b9\u6cd5\u662f\u4f7f\u7528\u201cawk -F:'{ print $1}'\/etc\/passwd\u201d\u547d\u4ee4\u3002\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u4ee5\u5192\u53f7\u4e3a\u5206\u9694\u7b26\uff0c\u63d0\u53d6\/etc\/passwd\u6587\u4ef6\u4e2d\u7684\u7b2c\u4e00\u4e2a\u5b57\u6bb5\uff0c\u5e76\u4ee5\u6b64\u663e\u793a\u6240\u6709\u7528\u6237\u7684\u7528\u6237\u540d\u3002\u8fd9\u662f\u4e00\u79cd\u7b80\u5355\u800c\u6709\u6548\u7684\u65b9\u6cd5\u3002<\/p>\n

\u67e5\u770b\u7528\u6237\u4e34\u65f6\u8868\u7a7a\u95f4_\u67e5\u770b\u7528\u6237\u534f\u8bae_linux\u67e5\u770b\u6240\u6709\u7528\u6237<\/p>\n

\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n

\n

bash\n   awk -F:'{ print $1}'\/etc\/passwd\n   <\/pre>\n<\/p>\n

5.\u4f7f\u7528\u201cw\u201d\u547d\u4ee4<\/p>\n

\u7b2c\u4e94\u79cd\u65b9\u6cd5\u662f\u4f7f\u7528\u201cw\u201d\u547d\u4ee4\u3002\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u663e\u793a\u5f53\u524d\u7cfb\u7edf\u4e0a\u767b\u5f55\u7684\u7528\u6237\u4fe1\u606f\uff0c\u5305\u62ec\u7528\u6237\u540d\u3001\u767b\u5f55\u65f6\u95f4\u3001\u767b\u5f55\u7ec8\u7aef\u7b49\u3002\u901a\u8fc7\u67e5\u770b\u5f53\u524d\u767b\u5f55\u7528\u6237\uff0c\u6211\u4eec\u53ef\u4ee5\u4e86\u89e3\u7cfb\u7edf\u7684\u4f7f\u7528\u60c5\u51b5\u3002<\/p>\n

\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n

\n

bash\n   w\n   <\/pre>\n<\/p>\n

6.\u4f7f\u7528\u201cwho\u201d\u547d\u4ee4<\/p>\n

\u7b2c\u516d\u79cd\u65b9\u6cd5\u662f\u4f7f\u7528\u201cwho\u201d\u547d\u4ee4\u3002\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u663e\u793a\u5f53\u524d\u767b\u5f55\u7cfb\u7edf\u7684\u7528\u6237\u4fe1\u606f\uff0c\u5305\u62ec\u7528\u6237\u540d\u3001\u767b\u5f55\u65f6\u95f4\u3001\u767b\u5f55\u7ec8\u7aef\u7b49\u3002\u4e0e\"w\"\u547d\u4ee4\u7c7b\u4f3c\uff0c\u5b83\u4e5f\u80fd\u591f\u5e2e\u52a9\u6211\u4eec\u4e86\u89e3\u7cfb\u7edf\u7684\u4f7f\u7528\u60c5\u51b5\u3002<\/p>\n

\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n

\n

bash\n   who\n   <\/pre>\n<\/p>\n

7.\u4f7f\u7528\u201clast\u201d\u547d\u4ee4<\/p>\n

\u7b2c\u4e03\u79cd\u65b9\u6cd5\u662f\u4f7f\u7528\u201clast\u201d\u547d\u4ee4\u3002\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u663e\u793a\u6700\u8fd1\u767b\u5f55\u7cfb\u7edf\u7684\u7528\u6237\u4fe1\u606flinux\u67e5\u770b\u6240\u6709\u7528\u6237<\/strong>\uff0c\u5305\u62ec\u7528\u6237\u540d\u3001\u767b\u5f55\u65f6\u95f4\u3001\u767b\u5f55\u7ec8\u7aef\u7b49\u3002\u901a\u8fc7\u67e5\u770b\u6700\u8fd1\u767b\u5f55\u7528\u6237linux\u547d\u4ee4\u8be6\u89e3\u8bcd\u5178\uff0c\u6211\u4eec\u53ef\u4ee5\u8ffd\u8e2a\u7cfb\u7edf\u7684\u4f7f\u7528\u5386\u53f2\u3002<\/p>\n

\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n

\n

bash\n   last\n   <\/pre>\n<\/p>\n

\u901a\u8fc7\u4ee5\u4e0a\u4e03\u79cd\u65b9\u6cd5linux\u793e\u533a\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5730\u67e5\u770bLinux\u7cfb\u7edf\u4e2d\u7684\u6240\u6709\u7528\u6237\u3002\u65e0\u8bba\u662f\u4e86\u89e3\u7cfb\u7edf\u7684\u7528\u6237\u60c5\u51b5\uff0c\u8fd8\u662f\u8fdb\u884c\u7528\u6237\u7ba1\u7406\u548c\u6743\u9650\u63a7\u5236\uff0c\u8fd9\u4e9b\u547d\u4ee4\u90fd\u80fd\u5e2e\u52a9\u6211\u4eec\u66f4\u597d\u5730\u7ba1\u7406\u548c\u4e86\u89e3\u7cfb\u7edf\u3002\u5e0c\u671b\u672c\u6587\u5bf9\u8bfb\u8005\u5728Linux\u7cfb\u7edf\u4e2d\u67e5\u770b\u6240\u6709\u7528\u6237\u65b9\u9762\u63d0\u4f9b\u4e86\u5e2e\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u672c\u6587\u5c06\u5206\u4eab\u5982\u4f55\u4f7f\u7528Linux\u547d\u4ee4\u6765\u67e5\u770b\u6240\u6709\u7528\u6237\u7684\u65b9\u6cd5\u548c\u6280\u5de7\uff0c\u5e2e\u52a9\u8bfb\u8005\u66f4\u597d\u5730\u7ba1\u7406\u548c\u4e86\u89e3\u7cfb\u7edf\u4e2d\u7684\u7528\u6237\u4fe1\u606f\u3002\u901a\u8fc7\u67e5\u770b\u5f53\u524d\u767b\u5f55\u7528\u6237\uff0c\u6211\u4eec\u53ef\u4ee5\u4e86\u89e3\u7cfb\u7edf\u7684\u4f7f\u7528\u60c5\u51b5\u3002\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u663e\u793a\u6700\u8fd1\u767b\u5f55\u7cfb\u7edf\u7684\u7528\u6237\u4fe1\u606f\uff0c\u5305\u62ec\u7528\u6237\u540d\u3001\u767b\u5f55\u65f6\u95f4\u3001\u767b\u5f55\u7ec8\u7aef\u7b49\u3002\u901a\u8fc7\u67e5\u770b\u6700\u8fd1\u767b\u5f55\u7528\u6237\uff0c\u6211\u4eec\u53ef\u4ee5\u8ffd\u8e2a\u7cfb\u7edf\u7684\u4f7f\u7528\u5386\u53f2\u3002\u901a\u8fc7\u4ee5\u4e0a\u4e03\u79cd\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5730\u67e5\u770bLinux\u7cfb\u7edf\u4e2d\u7684\u6240\u6709\u7528\u6237\u3002\u5e0c\u671b\u672c\u6587\u5bf9\u8bfb\u8005\u5728Linux\u7cfb\u7edf\u4e2d\u67e5\u770b\u6240\u6709\u7528\u6237\u65b9\u9762\u63d0\u4f9b\u4e86\u5e2e\u52a9\u3002<\/p>\n","protected":false},"author":1,"featured_media":278754,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-278753","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/278753","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=278753"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/278753\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/278754"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=278753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=278753"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=278753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}