sudo\u6743\u9650<\/strong><\/div>\nSudo\u5141\u8bb8\u6388\u6743\u7528\u6237\u4f5c\u4e3a\u53e6\u4e00\u4e2a\u7528\u6237\uff08\u901a\u5e38root\u7528\u6237\uff09\u8fd0\u884c\u7a0b\u5e8f\u3002\u5982\u679c\u8981\u5c06sudo\u8bbf\u95ee\u6743\u6388\u4e88\u5176\u4ed6\u7528\u6237\uff0c\u53ea\u9700\u5c06\u8be5\u7528\u6237\u6dfb\u52a0\u5230sudo\u7ec4\uff1a<\/p>\n
\r\nbob@ubuntu-18-04:~$ sudo usermod -aG sudo username\r\n<\/pre>\nsudo\u7684\u4f7f\u7528\u65b9\u5f0f\u5c31\u662f\u5728\u547d\u4ee4\u524d\u9762\u52a0\u4e0asudo<\/code>\u547d\u4ee4\uff1a<\/p>\n\r\nbob@ubuntu-18-04:~$ sudo tail -1 \/etc\/passwd\r\n<\/pre>\n\u7b2c\u4e00\u6b21\u5728\u4f1a\u8bdd\u4e2d\u4f7f\u7528sudo\u65f6\uff0c\u7cfb\u7edf\u63d0\u793a\u8f93\u5165\u5f53\u524d\u7528\u6237\u7684\u5bc6\u7801\uff0c\u5982\u679c\u8981\u505a\u5230\u4f7f\u7528sudo<\/code>\u514d\u5bc6\u7801\uff0c\u5219\u9700\u8981\u7f16\u8f91\/etc\/sudoers<\/code>\u6587\u4ef6\uff0c\u53ef\u4ee5\u8fd0\u884c\u4e0b\u9762\u547d\u4ee4\u6765\u7f16\u8f91\u8fd9\u4e2a\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n\r\nbob@ubuntu-18-04:~$ sudo visudo \r\n<\/pre>\n\u627e\u5230%sudo ALL=(ALL:ALL) ALL\u8fd9\u4e00\u884c\uff0c\u5728\u6307\u5b9a\u4f4d\u7f6e\u6dfb\u52a0NOPASSWD: <\/code>\uff0c\u7136\u540e\u4fdd\u5b58\u9000\u51fa\uff0c\u5c31\u53ef\u4ee5\u514d\u5bc6\u7801\u4f7f\u7528sudo<\/code>\u4e86\u3002<\/p>\n\r\n%sudo ALL=(ALL:ALL) NOPASSWD: ALL\r\n<\/pre>\n<\/p>\n
\u5f00\u542froot\u7528\u6237\u8d26\u53f7<\/strong><\/div>\n\u5982\u679c\u51fa\u4e8e\u67d0\u79cd\u539f\u56e0\uff0c\u9700\u8981\u542f\u7528root\u5e10\u6237\uff0c\u53ea\u9700\u4e3aroot\u7528\u6237\u8bbe\u7f6e\u5bc6\u7801\u5c31\u53ef\u4ee5\u4e86\u3002\u666e\u901a\u7528\u6237\u9996\u5148\u9700\u8981\u6709sudo\u6743\u9650\uff0c\u7136\u540e\u6267\u884csudo passwd root<\/code>\u4e3aroot\u7528\u6237\u8bbe\u7f6e\u5bc6\u7801\uff1a<\/p>\n\r\nbob@ubuntu-18-04:~$ sudo passwd root\r\nEnter new UNIX password: \r\nRetype new UNIX password: \r\npasswd: password updated successfully\r\n<\/pre>\n
\n\u53ef\u4ee5\u770b\u5230\uff0c\u4f7f\u7528su<\/code>\u547d\u4ee4\u5207\u6362\u5230root\u7528\u6237\uff0c\u8f93\u5165\u5bc6\u7801\uff0c\u53ef\u4ee5\u5207\u6362\u5230root\u7528\u6237\u4e86\u3002
\n
\n\u5c31\u8fd9\u6837\uff0c\u4f60\u53ef\u4ee5\u7528root\u7528\u6237\u767b\u5f55\u7cfb\u7edf\u5566\u3002<\/p>\n\u5173\u95edroot\u7528\u6237<\/strong><\/div>\n\u5f53\u4e0d\u5728\u9700\u8981\u4f7f\u7528root\u8d26\u53f7\u767b\u5f55\u65f6\uff0c\u53ef\u4ee5\u8bbe\u7f6eroot\u7528\u6237\u7684\u5bc6\u7801\u4e3a\u8fc7\u671f\uff0c\u5173\u95edroot\u7528\u6237\u7684\u5bc6\u7801\uff1a<\/p>\n
\r\nbob@ubuntu-18-04:~$ sudo passwd -l root\r\npasswd: password expiry information changed.\r\n<\/pre>\n
\n\u8bbe\u7f6eroot\u5bc6\u7801\u8fc7\u671f\u4e4b\u540e\uff0c\u4f7f\u7528su<\/code>\u547d\u4ee4\u5207\u6362\u5230root\u7528\u6237\uff0c\u53d1\u73b0\u63d0\u793a\u8ba4\u8bc1\u5931\u8d25\uff1a<\/p>\n\r\nbob@ubuntu-18-04:~$ su - root\r\nPassword: \r\nsu: Authentication failure\r\n<\/pre>\n
\n\u8fd9\u6837root\u7528\u6237\u5c31\u4e0d\u80fd\u767b\u5f55\u5566\u3002<\/p>\n
\u603b\u7ed3<\/strong><\/div>\n\u8bbe\u7f6e\u5bc6\u7801\u65f6\uff0c\u8bf7\u786e\u4fdd\u4f7f\u7528\u7684\u662f\u4e00\u4e2a\u5f3a\u800c\u552f\u4e00\u7684\u5bc6\u7801\u3002\u5f3a\u5bc6\u7801\u901a\u5e38\u81f3\u5c11\u670916\u4e2a\u5b57\u7b26\uff0c\u81f3\u5c11\u6709\u4e00\u4e2a\u5927\u5199\u5b57\u6bcd\u3001\u4e00\u4e2a\u5c0f\u5199\u5b57\u6bcd\u3001\u4e00\u4e2a\u6570\u5b57\u548c\u4e00\u4e2a\u7279\u6b8a\u5b57\u7b26\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
Sudo\u5141\u8bb8\u6388\u6743\u7528\u6237\u4f5c\u4e3a\u53e6\u4e00\u4e2a\u7528\u6237\uff08\u901a\u5e38root\u7528\u6237\uff09\u8fd0\u884c\u7a0b\u5e8f\u3002\u5982\u679c\u8981\u5c06sudo\u8bbf\u95ee\u6743\u6388\u4e88\u5176\u4ed6\u7528\u6237\uff0c\u53ea\u9700\u5c06\u8be5\u7528 […]<\/p>\n","protected":false},"author":362,"featured_media":193660,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-193659","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\/193659","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\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=193659"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/193659\/revisions"}],"predecessor-version":[{"id":193667,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/193659\/revisions\/193667"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/193660"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=193659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=193659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=193659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}