{"id":2032,"date":"2019-05-26T23:38:31","date_gmt":"2019-05-26T15:38:31","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=2032"},"modified":"2019-05-30T12:50:29","modified_gmt":"2019-05-30T04:50:29","slug":"gpasswd","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/gpasswd","title":{"rendered":"gpasswd\u547d\u4ee4 – \u8bbe\u7f6e\u7ba1\u7406\u7528\u6237\u7ec4"},"content":{"rendered":"\n
gpasswd\u547d\u4ee4\u662fLinux\u4e0b\u5de5\u4f5c\u7ec4\u6587\u4ef6\/etc\/group\u548c\/etc\/gshadow\u7684\u7ba1\u7406\u5de5\u5177 \uff0c\u7cfb\u7edf\u7ba1\u7406\u5458\u53ef\u4ee5\u4f7f\u7528-a\u9009\u9879\u5b9a\u4e49\u7ec4\u7ba1\u7406\u5458\uff0c\u4f7f\u7528-m\u9009\u9879\u5b9a\u4e49\u6210\u5458\uff0c\u7531\u7ec4\u7ba1\u7406\u5458\u7528\u7ec4\u540d\u8c03\u7528\u7684gpasswd\u53ea\u63d0\u793a\u8f93\u5165\u7ec4\u7684\u65b0\u5bc6\u7801\u3002<\/p>\n\n\n\n
\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>gpasswd [\u53c2\u6570]<\/p>\n\n\n\n \u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n \u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n \u4f7f\u7528-a\u53c2\u6570\u628aredis\u7528\u6237\u6dfb\u52a0\u5230linuxcool\u7528\u6237\u7ec4\uff1a<\/p>\n\n\n\n \u663e\u793a\u4e0a\u9762\u4f7f\u7528-a\u53c2\u6570\u6dfb\u52a0\u7528\u6237\u5230\u7ec4\u7528\u4fe1\u606f\uff1a<\/p>\n\n\n\n \u4f7f\u7528-d\u53c2\u6570\u4ecelinuxcool\u7ec4\u4e2d\u5220\u9664redis\u7528\u6237\uff1a<\/p>\n\n\n\n \u663e\u793alinuxcool\u7ec4\u7528\u7684redis\u7528\u6237\u662f\u5426\u5220\u9664\u6210\u529f\uff1a<\/p>\n\n\n\n gpasswd\u547d\u4ee4\u662fLinux\u4e0b\u5de5\u4f5c\u7ec4\u6587\u4ef6\/etc\/group\u548c\/etc\/gshadow\u7684\u7ba1\u7406\u5de5\u5177 \uff0c\u7cfb\u7edf\u7ba1\u7406 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/2032"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=2032"}],"version-history":[{"count":9,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/2032\/revisions"}],"predecessor-version":[{"id":2930,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/2032\/revisions\/2930"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=2032"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=2032"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=2032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}-a<\/td> \u6dfb\u52a0\u7528\u6237\u5230\u7ec4<\/td><\/tr> -d<\/td> \u4ece\u7ec4\u5220\u9664\u7528\u6237<\/td><\/tr> -A<\/td> \u6307\u5b9a\u7ba1\u7406\u5458<\/td><\/tr> -M<\/td> \u6307\u5b9a\u7ec4\u6210\u5458\u548c-A\u7684\u7528\u9014\u5dee\u4e0d\u591a<\/td><\/tr> -r<\/td> \u5220\u9664\u5bc6\u7801<\/td><\/tr> -R<\/td> \u9650\u5236\u7528\u6237\u767b\u5165\u7ec4\uff0c\u53ea\u6709\u7ec4\u4e2d\u7684\u6210\u5458\u624d\u53ef\u4ee5\u7528newgrp\u52a0\u5165\u8be5\u7ec4<\/td><\/tr><\/tbody><\/table>\n\n\n\n [root@linuxcool ~]# gpasswd -a redis linuxcool\n Adding user redis to group linuxcool<\/pre>\n\n\n\n
[root@linuxcool ~]# more \/etc\/group|grep linuxcool\n linuxcool:x:1005:redis<\/pre>\n\n\n\n
[root@linuxcool ~]# gpasswd -d redis linuxcool\n Removing user redis from group linuxcool<\/pre>\n\n\n\n
[root@linuxcool ~]# more \/etc\/group|grep linuxcool\n linuxcool:x:1005:<\/pre>\n","protected":false},"excerpt":{"rendered":"