{"id":257034,"date":"2022-12-07T08:32:34","date_gmt":"2022-12-07T00:32:34","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=257034"},"modified":"2022-11-07T08:33:52","modified_gmt":"2022-11-07T00:33:52","slug":"linux-useradd-root","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-useradd-root.html","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 useradd \u547d\u4ee4\uff1f"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | useradd \u547d\u4ee4\u53ef\u4ee5\u8ba9\u8d85\u7ea7\u7528\u6237\uff08\u6bd4\u5982root\uff09\u5728 Linux \u7cfb\u7edf\u4e2d\u521b\u5efa\u65b0\u7684\u7528\u6237\u8d26\u6237\u3002\u4e0b\u9762\u6211\u4eec\u6765\u8be6\u7ec6\u770b\u4e0b\u5982\u4f55\u4f7f\u7528 useradd \u547d\u4ee4\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n AJNAPY Data Background digital illustration<\/p>\n \u6211\u4eec\u5728\u200b\u200b\u300a\u5982\u4f55\u5728 Ubuntu\u548c Debian \u4e0a\u521b\u5efa sudo \u7528\u6237\u300b\u200b\u200b\u200b\u4e00\u6587\u4e2d\u63d0\u5230\u8fc7\u00a0useradd\u00a0\u547d\u4ee4\uff0cuseradd \u547d\u4ee4\u53ef\u4ee5\u8ba9\u8d85\u7ea7\u7528\u6237<\/strong>\uff08\u6bd4\u5982root\uff09\u5728 Linux \u7cfb\u7edf\u4e2d\u521b\u5efa\u65b0\u7684\u7528\u6237\u8d26\u6237\u3002<\/p>\n \u5b83\u662f\u4e00\u4e2a\u4f4e\u7ea7\u5b9e\u7528\u7a0b\u5e8f\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u53ea\u662f\u7b80\u5355\u7684\u521b\u5efa\u7528\u6237\uff0c\u4f46\u662f\u63d0\u4f9b\u4e86\u51e0\u4e2a\u9009\u9879\u6765\u521b\u5efa\u5177\u6709\u5404\u79cd\u914d\u7f6e\u7684\u7528\u6237\u3002<\/p>\n \u4ee5\u4e0b\u662fuseradd\u547d\u4ee4\u7684\u8bed\u6cd5\uff1a<\/p>\n \u5728\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\uff0c\u5fc5\u987b\u662f root \u7528\u6237\u6216\u8005\u5177\u6709 sudo \u6743\u9650\u7684\u7528\u6237\u624d\u80fd\u4f7f\u7528\u6b21\u547d\u4ee4 \u4e0d\u5e26\u4efb\u4f55\u9009\u9879\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528 useradd \u547d\u4ee4\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n \u4e0a\u8ff0\u547d\u4ee4\u4f1a\u521b\u5efa\u4e00\u4e2a\u7528\u6237\u8d26\u6237\uff0c\u4f46\u662f\uff1a<\/p>\n \u5982\u6b64\uff0c\u53ef\u4ee5\u4f7f\u7528 passwd \u547d\u4ee4\u4e3a\u6b64\u65b0\u7528\u6237\u8d26\u6237\u8bbe\u7f6e\u5bc6\u7801\uff1a<\/p>\n useradd \u547d\u4ee4\u7684\u00a0-m\u00a0\u9009\u9879\u53ef\u4ee5\u5c06\u7cfb\u7edf\u6846\u67b6\u76ee\u5f55\uff08system skeleton directory\uff0c\u4f4d\u4e8e\u00a0\/etc\/skel\uff09\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u590d\u5236\u5230\u65b0\u521b\u5efa\u7684\u4e3b\u76ee\u5f55\u4e2d\u3002<\/p>\n \u8fd9\u6837\u5c31\u610f\u5473\u7740\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 -m \u9009\u9879\u6765\u521b\u5efa\u4e00\u4e2a\u5177\u6709\u4e3b\u76ee\u5f55\u7684\u7528\u6237\uff1a<\/p>\n \u6b64\u5916\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528 -d \u9009\u9879\u5c06\u73b0\u6709\u7684\u4e00\u4e2a\u76ee\u5f55\u6307\u5b9a\u4e3a\u65b0\u521b\u5efa\u7528\u6237\u7684\u4e3b\u76ee\u5f55\uff1a<\/p>\n useradd \u547d\u4ee4\u521b\u5efa\u7684\u65b0\u7528\u6237\uff0c\u5176\u9ed8\u8ba4 shell \u662f sh\u3002\u5728\u73b0\u4ee3\u7cfb\u7edf\u4e2d\uff0c\u5c24\u5176\u5f53 bash \u6216\u8005 zsh \u8bde\u751f\u4ee5\u540e\uff0c\u5df2\u7ecf\u5f88\u5c11\u4eba\u5728\u4f7f\u7528 sh \u4e86\u3002<\/p>\n \u6211\u4eec\u53ef\u4ee5\u5728\u521b\u5efa\u7528\u6237\u540e\u66f4\u6539\u5176\u9ed8\u8ba4 shell\uff0c\u4f46\u4e5f\u53ef\u4ee5\u5728\u521b\u5efa\u7528\u6237\u8d26\u6237\u7684\u540c\u65f6\u4f7f\u7528\u00a0-s\u00a0\u9009\u9879\u6765\u6307\u5b9a\u4e00\u4e2a\u9ed8\u8ba4\u7684 shell\u3002<\/p>\n \u6bd4\u5982\uff0c\u5982\u679c\u6211\u4eec\u60f3\u8981\u5c06 bash \u4f5c\u4e3a\u65b0\u7528\u6237\u7684\u9ed8\u8ba4 shell\uff0c\u53ef\u4ee5\u6267\u884c\u5982\u4e0b\u64cd\u4f5c\uff1a<\/p>\n \u901a\u5e38\uff0c\u521b\u5efa\u65b0\u7528\u6237\u65f6\uff0c\u4f1a\u521b\u5efa\u4e0e\u8be5\u7528\u6237\u540c\u540d\u7684\u7ec4\uff0c\u65b0\u7528\u6237\u88ab\u6dfb\u52a0\u4e3a\u6b64\u7ec4\u7684\u6210\u5458\u3002<\/p>\n \u4f7f\u7528\u9009\u9879\u00a0-g\uff0c\u53ef\u4ee5\u5c06\u65b0\u7528\u6237\u6dfb\u52a0\u5230\u5df2\u5b58\u5728\u7684\u7ec4<\/strong>\u4e2d\uff0c\u4f5c\u4e3a\u5176\u9ed8\u8ba4\u7ec4\uff1a<\/p>\n \u6bd4\u5982\u6211\u4eec\u5728\u4e3a\u5f00\u53d1\u4eba\u5458\u521b\u5efa\u8d26\u6237\uff0c\u53ef\u80fd\u5e0c\u671b\u5c06\u6240\u6709\u5f00\u53d1\u4eba\u5458\u6dfb\u52a0\u5230 \"dev\" \u7ec4\u4e2d\u3002<\/p>\n \u6b64\u5916\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528\u9009\u9879 -G\uff08\u5927\u5199\u7684G\uff09\uff0c\u989d\u5916\u5c06\u7528\u6237\u6dfb\u52a0\u5230\u5176\u4ed6\u73b0\u6709\u7ec4\u4e2d\uff1a<\/p>\n \u6bd4\u5982\uff0c\u5982\u679c\u6211\u4eec\u9700\u8981\u200b\u200b\u521b\u5efa\u4e00\u4e2a sudo \u7528\u6237\u200b\u200b\u200b\uff0c\u90a3\u4e48\u5728\u521b\u5efa\u8be5\u7528\u6237\u7684\u65f6\u5019\u8fd8\u9700\u8981\u5c06\u5176\u6dfb\u52a0\u5230 sudo \u7ec4\u4e2d\uff0c\u8fd9\u662f\u5176\u4e2d\u4e00\u4e2a\u5e94\u7528\u573a\u666f\u3002<\/p>\n \u5728\u4f7f\u7528 useradd \u547d\u4ee4\u521b\u5efa\u65b0\u7528\u6237\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u4f7f\u7528\u5176 -u \u9009\u9879\u4e3a\u65b0\u7528\u6237\u6307\u5b9a\u4e00\u4e2a\u7528\u6237ID\uff08UID\uff09\uff1a<\/p>\n \u4e0a\u9762\u6211\u4eec\u4ecb\u7ecd\u4e86 useradd \u547d\u4ee4\u7684\u4e00\u4e9b\u4f7f\u7528\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5b83\u7684\u591a\u4e2a\u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\uff0c\u4f7f\u7528\u9884\u5b9a\u4e49\u7684\u914d\u7f6e\u5728 Linux \u4e2d\u521b\u5efa\u65b0\u7528\u6237\uff0c\u6bd4\u5982\uff1a<\/p>\n \u5982\u524d\u6587\u6240\u5c5e\uff0c\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cuseradd \u547d\u4ee4\u529f\u80fd\u6bd4\u8f83\u5355\u4e00\uff0c\u53ea\u662f\u7b80\u5355\u7684\u521b\u5efa\u7528\u6237\uff0c\u6240\u4ee5\u6709\u5f88\u591a\u4eba\u66f4\u559c\u6b22\u4f7f\u7528 adduser \u547d\u4ee4\u3002\u5173\u4e8eadduser \u548c useradd \u547d\u4ee4\u7684\u533a\u522b\uff0c\u6211\u4eec\u4f1a\u5728\u4ee5\u540e\u5355\u72ec\u4ecb\u7ecd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" AJNAPY Data Background digital illustration \u6211\u4eec\u5728\u200b\u200b\u300a\u5982\u4f55\u5728 U […]<\/p>\n","protected":false},"author":323,"featured_media":256949,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-257034","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\/257034","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\/323"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=257034"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/257034\/revisions"}],"predecessor-version":[{"id":257069,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/257034\/revisions\/257069"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/256949"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=257034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=257034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=257034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}} |