{"id":120,"date":"2014-08-06T15:01:30","date_gmt":"2014-08-06T07:01:30","guid":{"rendered":"http:\/\/www.codeeel.com\/?p=120"},"modified":"2014-08-06T15:01:30","modified_gmt":"2014-08-06T07:01:30","slug":"centos-%e6%b7%bb%e5%8a%a0%e7%94%a8%e6%88%b7","status":"publish","type":"post","link":"https:\/\/www.codeeel.com\/?p=120","title":{"rendered":"centos \u6dfb\u52a0\u7528\u6237"},"content":{"rendered":"<p>1\u3001\u6dfb\u52a0\u7528\u6237\uff0c\u9996\u5148\u7528adduser\u547d\u4ee4\u6dfb\u52a0\u4e00\u4e2a\u666e\u901a\u7528\u6237\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<p>#adduser tommy<\/p>\n<p>\/\/\u6dfb\u52a0\u4e00\u4e2a\u540d\u4e3atommy\u7684\u7528\u6237<\/p>\n<p>#passwd tommy\u00a0\u00a0 \/\/\u4fee\u6539\u5bc6\u7801<\/p>\n<p>Changing password for user tommy.<\/p>\n<p>New UNIX password:\u00a0\u00a0\u00a0\u00a0 \/\/\u5728\u8fd9\u91cc\u8f93\u5165\u65b0\u5bc6\u7801<\/p>\n<p>Retype new UNIX password:\u00a0 \/\/\u518d\u6b21\u8f93\u5165\u65b0\u5bc6\u7801<\/p>\n<p>passwd: all authentication tokens updated successfully.<\/p>\n<p>2\u3001\u8d4b\u4e88root\u6743\u9650<\/p>\n<p>\u65b9\u6cd5\u4e00\uff1a \u4fee\u6539\/etc\/sudoers \u6587\u4ef6\uff0c\u627e\u5230\u4e0b\u9762\u4e00\u884c\uff0c\u628a\u524d\u9762\u7684\u6ce8\u91ca\uff08#\uff09\u53bb\u6389<\/p>\n<p>## Allows people in group wheel to run all commands<\/p>\n<p>%wheel\u00a0\u00a0\u00a0 ALL=(ALL)\u00a0\u00a0\u00a0 ALL<\/p>\n<p>\u7136\u540e\u4fee\u6539\u7528\u6237\uff0c\u4f7f\u5176\u5c5e\u4e8eroot\u7ec4\uff08wheel\uff09\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<p>#usermod -g root tommy<\/p>\n<p>\u4fee\u6539\u5b8c\u6bd5\uff0c\u73b0\u5728\u53ef\u4ee5\u7528tommy\u5e10\u53f7\u767b\u5f55\uff0c\u7136\u540e\u7528\u547d\u4ee4su \u2013 \uff0c\u5373\u53ef\u83b7\u5f97root\u6743\u9650\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<p>\u65b9\u6cd5\u4e8c\uff1a \u4fee\u6539\/etc\/sudoers \u6587\u4ef6\uff0c\u627e\u5230\u4e0b\u9762\u4e00\u884c\uff0c\u5728root\u4e0b\u9762\u6dfb\u52a0\u4e00\u884c\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p>## Allow root to run any commands anywhere<\/p>\n<p>root\u00a0\u00a0\u00a0 ALL=(ALL)\u00a0\u00a0\u00a0\u00a0 ALL<\/p>\n<p>tommy\u00a0\u00a0 ALL=(ALL)\u00a0\u00a0\u00a0\u00a0 ALL<\/p>\n<p>\u4fee\u6539\u5b8c\u6bd5\uff0c\u73b0\u5728\u53ef\u4ee5\u7528tommy\u5e10\u53f7\u767b\u5f55\uff0c\u7136\u540e\u7528\u547d\u4ee4su \u2013 \uff0c\u5373\u53ef\u83b7\u5f97root\u6743\u9650\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<p>\u65b9\u6cd5\u4e09\uff1a \u4fee\u6539\/etc\/passwd \u6587\u4ef6\uff0c\u627e\u5230\u5982\u4e0b\u884c\uff0c\u628a\u7528\u6237ID\u4fee\u6539\u4e3a0 \uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p>tommy:x:500:500:tommy:\/home\/tommy:\/bin\/bash<\/p>\n<p>\u4fee\u6539\u540e\u5982\u4e0b<\/p>\n<p>tommy:x:0:500:tommy:\/home\/tommy:\/bin\/bash<\/p>\n<p>\u4fdd\u5b58\uff0c\u7528tommy\u8d26\u6237\u767b\u5f55\u540e\uff0c\u76f4\u63a5\u83b7\u53d6\u7684\u5c31\u662froot\u5e10\u53f7\u7684\u6743\u9650\u3002<\/p>\n<p>\u53cb\u60c5\u63d0\u9192\uff1a\u867d\u7136\u65b9\u6cd5\u4e09\u770b\u4e0a\u53bb\u7b80\u5355\u65b9\u4fbf\uff0c\u4f46\u4e00\u822c\u4e0d\u63a8\u8350\u4f7f\u7528\uff0c\u63a8\u8350\u4f7f\u7528\u65b9\u6cd5\u4e8c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u6dfb\u52a0\u7528\u6237\uff0c\u9996\u5148\u7528adduser\u547d\u4ee4\u6dfb\u52a0\u4e00\u4e2a\u666e\u901a\u7528\u6237\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a #adduser tommy \/\/\u6dfb\u52a0\u4e00\u4e2a\u540d\u4e3atommy\u7684\u7528\u6237 #passwd tommy\u00a0\u00a0 \/\/\u4fee\u6539\u5bc6\u7801 Changing password for user tommy. New UNIX password:\u00a0\u00a0\u00a0\u00a0 \/\/\u5728\u8fd9\u91cc\u8f93\u5165\u65b0\u5bc6\u7801 Ret<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[75,74,76],"_links":{"self":[{"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/posts\/120"}],"collection":[{"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=120"}],"version-history":[{"count":1,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/posts\/120\/revisions"}],"predecessor-version":[{"id":121,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/posts\/120\/revisions\/121"}],"wp:attachment":[{"href":"https:\/\/www.codeeel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}