{"id":295165,"date":"2024-12-25T04:05:20","date_gmt":"2024-12-24T20:05:20","guid":{"rendered":"https:\/\/lrxjmw.cn\/lyhyyhzgltjx.html"},"modified":"2024-12-25T04:05:20","modified_gmt":"2024-12-24T20:05:20","slug":"lyhyyhzgltjx","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lyhyyhzgltjx.html","title":{"rendered":"Linux\u7528\u6237\u4e0e\u7528\u6237\u7ec4\u7ba1\u7406\uff1a\u6dfb\u52a0\u65b0\u7528\u6237\u3001\u591a\u7ec4\u5206\u914d\u53ca\u4e3b\u9644\u5c5e\u7ec4\u533a\u522b\u8be6\u89e3"},"content":{"rendered":"

1\u3001Linux<\/a>\u7528\u6237\u4e0e\u7528\u6237\u7ec4\u76f8\u5173\u95ee\u9898<\/p>\n

\u600e\u4e48\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7528\u6237\u5230\u4e00\u4e2a\u7279\u5b9a\u7684\u7ec4\u4e2d\uff1f<\/p>\n

\u600e\u4e48\u540c\u65f6\u5c06\u7528\u6237\u6dfb\u52a0\u5230\u591a\u4e2a\u7ec4\u4e2d\uff1f<\/p>\n

\u600e\u6837\u5c06\u4e00\u4e2a\u5df2\u5b58\u5728\u7684\u7528\u6237\u8054\u901a\u5230\u67d0\u4e2a\u7ec4\u6216\u5219\u7ed9\u4ed6\u964d\u4f4e\u4e00\u4e2a\u7ec4?<\/p>\n

\u57fa\u672c\u7ec4\u4e0e\u9644\u5c5e\u7ec4\u7684\u533a\u522b\uff1f<\/p>\n

2\u3001\u7528\u6237\u76f8\u5173\u7684\u547d\u4ee4<\/a>\u89e3\u8bf4<\/p>\n

groupadd\u6dfb\u52a0\u7528\u6237\u7ec4<\/p>\n

useradd\u964d\u4f4e\u4e00\u4e2a\u65b0\u7528\u6237\u6216\u5219\u66f4\u65b0\u9ed8\u8ba4\u65b0\u7528\u6237\u4fe1\u606f\u3002<\/p>\n

usermod\u4fee\u6539\u7528\u6237\u8d26\u6237\u5c5e\u6027\u3002<\/p>\n

3\u3001\u6982\u5ff5\u548c\u76f8\u5173\u6587\u4ef6\u8bf4\u660e<\/p>\n

linux\u521b\u5efa\u7528\u6237\u7ec4gid_linux\u521b\u5efa\u7528\u6237\u548c\u7ec4\u5e76\u8d4b\u6743_linux\u521b\u5efa\u7528\u6237\u7ec4\u548c\u7528\u6237<\/p>\n

\u5728Linux\u7528\u6237\u7cfb\u7edf\u4e2d\u5b58\u5728\u4e24\u7c7b\u7ec4\u3002<\/p>\n

\u7b2c\u4e00\u7c7b\u662f\u4e3b\u8981\u7528\u6237\u7ec4\uff08\u4e3b\u7ec4\uff09linux\u521b\u5efa\u7528\u6237\u7ec4\u548c\u7528\u6237<\/strong>linux windows\uff0c\u7b2c\u4e8c\u7c7b\u662f\u9644\u52a0\u7528\u6237\u7ec4\uff08\u9644\u5c5e\u7ec4\uff09\u3002<\/p>\n

\u4e3b\u7ec4\uff1a\u4e5f\u88ab\u79f0\u4e3aprimarygroup\u3001firstgroup\u6216initiallogingrouplinux\u521b\u5efa\u7528\u6237\u7ec4\u548c\u7528\u6237<\/strong>\uff0c\u7528\u6237\u7684\u9ed8\u8ba4\u7ec4\uff0c\u7528\u6237\u7684gid\u6240\u6807\u793a\u7684\u7ec4\u3002<\/p>\n

\u9644\u5c5e\u7ec4\uff1a\u4e5f\u88ab\u79f0\u4e3aSecondarygroup\u6216supplementarygroup\uff0c\u7528\u6237\u7684\u9644\u52a0\u7ec4\u3002<\/p>\n

\u50a8\u5b58\u6587\u4ef6<\/p>\n

\u7528\u6237\u8d26\u6237\u53ca\u76f8\u5173\u4fe1\u606f\u90fd\u50a8\u5b58\u5728\/etc\/passwd\u6587\u4ef6\u4e2d\uff0c<\/p>\n

\u7528\u6237\u7ec4\u4fe1\u606f\u50a8\u5b58\u5728\/etc\/shadow\u548c\/etc\/group\u6587\u4ef6\u3002<\/p>\n

\u901a\u8fc7id\u547d\u4ee4\u67e5\u770b\u7528\u6237\u7684\u4e3b\u7ec4\u548c\u9644\u5c5e\u7ec4<\/p>\n

\n

[root@localhost ~]# id root\nuid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)\n

linux\u521b\u5efa\u7528\u6237\u7ec4gid_linux\u521b\u5efa\u7528\u6237\u7ec4\u548c\u7528\u6237_linux\u521b\u5efa\u7528\u6237\u548c\u7ec4\u5e76\u8d4b\u6743<\/p>\n[root@localhost ~]# id gg\nuid=503(gg) gid=503(gg) groups=503(gg)\n[root@localhost ~]# id mm\nuid=502(mm) gid=500(jww) groups=500(jww)<\/code><\/pre>\n<\/p>\n

gid\u6807\u793a\u4e3b\u7ec4\uff0cgroups\u8868\u793a\u7528\u6237\u6240\u5c5e\u7684\u5168\u90e8\u7ec4\uff08\u4e3b\u7ec4\u548c\u9644\u5c5e\u7ec4\uff09<\/p>\n

\u7528\u6237\u5fc5\u987b\u6709\u4e14\u53ea\u80fd\u6709\u4e00\u4e2a\u4e3b\u7ec4\uff0c\u53ef\u4ee5\u67090\u4e2a\u30011\u4e2a\u6216\u591a\u4e2a\u9644\u5c5e\u7ec4<\/p>\n

4\u3001\u65b0\u589e\u4e00\u4e2a\u7528\u6237\u5e76\u6dfb\u52a0\u5230\u6307\u5b9a\u7528\u6237\u7ec4<\/p>\n

\n

#\u68c0\u67e5\u7528\u6237\u7ec4\u662f\u5426\u5b58\u5728\uff0c\u5982\u679c\u7ec4\u5b58\u5728\u5219\u4f1a\u8f93\u51fa\u7ec4\u4fe1\u606f\uff0c\u5426\u5219\u6ca1\u6709\u4efb\u4f55\u8f93\u51fa\ngrep  \/etc\/group\n#\u5982\u679c\u7528\u6237\u7ec4\u4e0d\u5b58\u5728\u5219\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u65b0\u5efa\u7528\u6237\u7ec4\uff1a\ngroupadd \n#\u65b0\u5efa\u7528\u6237\u5e76\u5c06\u5176\u52a0\u5165\u6307\u5b9a\u7528\u6237\u7ec4,\u4f5c\u4e3a\u5176\u4e3b\u7528\u6237\u7ec4\uff08\u6bcf\u4e2a\u7528\u6237\u6709\u4e14\u53ea\u6709\u4e00\u4e2a\u4e3b\u7528\u6237\u7ec4\uff09\nuseradd -g  \n#\u6216\u8005 \u65b0\u5efa\u7528\u6237\u5e76\u5c06\u5176\u52a0\u5165\u6307\u5b9a\u9644\u5c5e\u7528\u6237\u7ec4\uff0c\u9644\u5c5e\u7528\u6237\u7ec4\u53ef\u4ee5\u6709\u591a\u4e2a\uff0c\u591a\u4e2a\u9644\u5c5e\u7ec4\u540d\u79f0\u7528\u9017\u53f7\u5206\u9694\u5373\u53ef\nuseradd -G  \n#\u8bbe\u7f6e\u7528\u6237\u5bc6\u7801\npasswd \n#\u67e5\u770b\u7528\u6237\u5c5e\u6027\uff0c\u68c0\u67e5\u662f\u5426\u6dfb\u52a0\u5230\u6b63\u786e\u7684\u7528\u6237\u7ec4\nid <\/code><\/pre>\n<\/p>\n

\u5e38\u7528\u6dfb\u52a0\u7528\u6237\u547d\u4ee4\uff08\u6dfb\u52a0\u7528\u6237\u5e76\u6dfb\u52a0\u5230\u4e3b\u7ec4\uff09\uff1auseradd-g<\/p>\n

linux\u521b\u5efa\u7528\u6237\u7ec4gid_linux\u521b\u5efa\u7528\u6237\u7ec4\u548c\u7528\u6237_linux\u521b\u5efa\u7528\u6237\u548c\u7ec4\u5e76\u8d4b\u6743<\/p>\n

5\u3001\u5c06\u5df2\u6709\u7528\u6237\u6dfb\u52a0\u5230\u6307\u5b9a\u7528\u6237\u7ec4<\/p>\n

\n

#\u5c06\u5df2\u6709\u7528\u6237\u6dfb\u52a0\u5230\u6307\u5b9a\u7528\u6237\u7ec4\uff0c\u4f5c\u4e3a\u5176\u9644\u5c5e\u7528\u6237\u7ec4\n# -a \u4ee3\u8868append\uff0c\u548c -G \u4e00\u8d77\u4f7f\u7528\uff0c\u5c06\u7528\u6237\u6dfb\u52a0\u5230\u65b0\u7528\u6237\u7ec4\u4e2d\u800c\u4e0d\u5fc5\u6765\u5f00\u539f\u6709\u7684\u5176\u4ed6\u7528\u6237\u7ec4\nusermod -a -G  \n#\u5c06\u5df2\u6709\u7528\u6237\u7684\u4e3b\u7528\u6237\u7ec4\u6539\u4e3a\u65b0\u7684\u7528\u6237\u7ec4\nusermod -g  <\/code><\/pre>\n<\/p>\n

6\u3001\u6dfb\u52a0\u7528\u6237linux vi \u547d\u4ee4\uff0c\u5e76\u6307\u5b9a\u5bb6\u76ee\u5f55\u3001\u6240\u5728\u7ec4\u3001\u767b\u5f55shell\u7b49\u4fe1\u606f<\/p>\n

\n

# -m \u81ea\u52a8\u5efa\u7acb\u7528\u6237\u5bb6\u76ee\u5f55\n# -g \u6307\u5b9a\u7528\u6237\u6240\u5728\u7684\u7ec4\n# -s \u6307\u5b9a\u7528\u6237\u767b\u5f55\u7684shell\nusermod -m -s \/bin\/bash -g  <\/code><\/pre>\n<\/p>\n

7\u3001\u5c06\u4e00\u4e2a\u7528\u6237\u4ece\u67d0\u4e2a\u7528\u6237\u7ec4\u5220\u6389<\/p>\n

\n

#\u5c06\u7528\u6237\u4ece\u8be5\u7528\u6237\u7684\u9644\u5c5e\u7ec4\u4e2d\u5220\u9664\ngpasswd -d  <\/code><\/pre>\n<\/p>\n

8\u3001\u5220\u9664\u7528\u6237<\/p>\n

\n

#\u6c38\u4e45\u6027\u5220\u9664\u7528\u6237\u8d26\u53f7\nuserdel <\/code><\/pre>\n<\/p>\n

\u53c2\u8003\u94fe\u63a5\uff1a<\/p>\n

Linux\u7cfb\u7edf\u5c06\u7528\u6237\u6dfb\u52a0\u5230\u7528\u6237\u7ec4-\u7b80\u4e66<\/p>\n

linux\u4e0b\u57fa\u672c\u7ec4\u548c\u9644\u5c5e\u7ec4\u6709\u54ea\u4e9b\u533a\u522b\uff1f_\u767e\u5ea6\u6653\u5f97<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5982\u4f55\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7528\u6237\u5230\u4e00\u4e2a\u7279\u5b9a\u7684\u7ec4\u4e2d\uff1f\u5982\u4f55\u540c\u65f6\u5c06\u7528\u6237\u6dfb\u52a0\u5230\u591a\u4e2a\u7ec4\u4e2d\uff1f\u5982\u4f55\u5c06\u4e00\u4e2a\u5df2\u5b58\u5728\u7684\u7528\u6237\u79fb\u52a8\u5230\u67d0\u4e2a\u7ec4\u6216\u8005\u7ed9\u4ed6\u589e\u52a0\u4e00\u4e2a\u7ec4?\u6dfb\u52a0\u7528\u6237\u7ec4\u7528\u6237\u7cfb\u7edf\u4e2d\u5b58\u5728\u4e24\u7c7b\u7ec4\u30024\u3001\u65b0\u589e\u4e00\u4e2a\u7528\u6237\u5e76\u6dfb\u52a0\u5230\u6307\u5b9a\u7528\u6237\u7ec45\u3001\u5c06\u5df2\u6709\u7528\u6237\u6dfb\u52a0\u5230\u6307\u5b9a\u7528\u6237\u7ec46\u3001\u6dfb\u52a0\u7528\u6237\uff0c\u5e76\u6307\u5b9a\u5bb6\u76ee\u5f55\u3001\u6240\u5728\u7ec4\u3001\u767b\u5f55shell\u7b49\u4fe1\u606f<\/p>\n","protected":false},"author":1,"featured_media":295166,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[5151,5154,5153,5152,3075],"class_list":["post-295165","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-lyhgl-2","tag-zfszqb","tag-dzfp","tag-tjxyh","tag-yhzgl"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/295165","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=295165"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/295165\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/295166"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=295165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=295165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=295165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}