\u9664\u4e86su\uff0c\u53e6\u4e00\u4e2a\u5207\u6362\u8eab\u4efd\u7684\u547d\u4ee4\u662fssh\uff1assh root@localhost\uff0c\u7b49\u540c\u4e8e\u6253\u5f00\u65b0\u7ec8\u7aefssh\u767b\u5f55<\/p><\/blockquote>\n
sudo\u547d\u4ee4<\/h2>\n
sudo<\/span><\/code>\u7a0b\u5e8f\u5f88\u65e9\u5c31\u51fa\u6765\u4e86\uff0c\u4f46\u76f4\u5230Ubuntu\u7684\u63a8\u5e7f\u624d\u6d41\u884c\u8d77\u6765\u3002Ubuntu\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u4e0d\u4f1a\u8bbe\u7f6eroot\u5bc6\u7801\uff0c\u9ed8\u8ba4\u4f7f\u7528\u666e\u901a\u8d26\u6237\u767b\u5f55\uff0csudo<\/span><\/code>\u4fbf\u662f\u666e\u901a\u8d26\u6237\u83b7\u53d6root\u6743\u9650\u7684\u547d\u4ee4\u3002<\/p>\nsudo<\/span><\/code>\u548csu<\/span><\/code>\u7684\u533a\u522b\u70b9\u4e3b\u8981\u6709\uff1a<\/p>\n\nsu<\/span><\/code>\u53ef\u4ee5\u4e0d\u5e26\u53c2\u6570\u6267\u884c\uff0csudo<\/span><\/code>\u4e0d\u884c<\/li>\nsudo<\/span><\/code>\u547d\u4ee4\u83b7\u53d6root\u6743\u9650\u65f6\u8f93\u5165\u7684\u662f\u7528\u6237\u5bc6\u7801\uff0c\u800csu<\/span><\/code>\u8981\u6c42\u8f93\u5165root\u5bc6\u7801\uff1b<\/li>\n- \u53ea\u6709
\/etc\/<\/span>sudo<\/span>\/<\/span>sudoers<\/span><\/code>\u6587\u4ef6\u4e2d\u7684\u7528\u6237\u624d\u80fd\u4f7f\u7528sudo<\/span><\/code>\u547d\u4ee4\uff0c\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u4f7f\u7528su<\/span><\/code>\u547d\u4ee4<\/li>\n- \u5f53root\u5bc6\u7801\u672a\u8bbe\u7f6e\u65f6\uff0c
sudo<\/span><\/code>\u80fd\u83b7\u53d6root\u6743\u9650\uff0csu<\/span><\/code>\u4e0d\u884c<\/li>\nsu<\/span><\/code>\u53ef\u4ee5\u5207\u6362\u5230\u5176\u4ed6\u7528\u6237\u767b\u5f55\uff0csudo<\/span><\/code>\u53ea\u80fd\u5207\u6362\u5230root\u7528\u6237(sudo su\u00a0<\/span>-<\/span>l\u00a0<\/span>\u7528\u6237\u540d<\/span><\/code>\u7684\u65b9\u5f0f\u53ef\u4ee5\uff0c\u4f46\u8fd9\u662fsu\u7684\u80fd\u529b)<\/li>\n<\/ol>\n\u6709\u4e86sudo<\/span><\/code>\uff0c\u53ef\u4ee5\u5728\u4e0d\u6cc4\u6f0f\uff08\u4e0d\u8bbe\u7f6e\uff09root\u5bc6\u7801\u7684\u524d\u63d0\u4e0b\u8ba9\u7528\u6237\u6267\u884c\u7279\u6743\u547d\u4ee4\uff0c\u5e76\u4e14sudo\u63d0\u4f9b\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff0c\u80fd\u5927\u5927\u63d0\u9ad8\u7cfb\u7edf\u7684\u5b89\u5168\u6027\uff0c\u56e0\u6b64\u5b9e\u8df5\u4e2d\u5efa\u8bae\u4f7f\u7528\u3002<\/p>\n\u548csu\u4e0d\u540c\uff0csudo\u547d\u4ee4\u9009\u9879\u4e30\u5bcc\uff0c\u4e0b\u9762\u4ecb\u7ecd\u4e00\u4e9b\u5e38\u89c1\u7528\u6cd5\uff1a<\/p>\n
\nsudo\u00a0<\/span>\u547d\u4ee4<\/span><\/code>\uff1a\u4ee5root\u8eab\u4efd\u6267\u884c\u547d\u4ee4\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\u547d\u4ee4\u9700\u8981\u9ed8\u8ba4PATH\u8def\u5f84\u4e0b\uff0c\u5426\u5219\u4f1a\u51fa\u73b0\u201dsudo: xxx command not found\u201d\u7684\u9519\u8bef(\u8bd5\u8bd5\u00a0sudo ll<\/span><\/code>)<\/li>\nsudo\u00a0<\/span>-<\/span>l<\/span><\/code>\uff1a\u5217\u51fa\u53ef\u7528\u7684\u547d\u4ee4<\/li>\nsudo\u00a0<\/span>-<\/span>i<\/span><\/code>\uff1a\u4ee5root\u8eab\u4efd\u767b\u5f55<\/li>\nsudo\u00a0<\/span>-<\/span>s<\/span><\/code>\uff1a\u4e00\u822c\u7b49\u540c\u4e8esudo bash<\/span><\/code>\uff0c\u8fdb\u5165root\u73af\u5883\uff0c\u4e0d\u6539\u53d8\u5de5\u4f5c\u76ee\u5f55<\/li>\nsudo su<\/span><\/code>\uff1a\u4ee5sudo<\/span><\/code>\u65b9\u5f0f\u6267\u884csu<\/span><\/code>\u547d\u4ee4\uff0c\u6b64\u65f6\u8f93\u5165\u7528\u6237\u5bc6\u7801\u5c31\u53ef\u4ee5\u4e86<\/li>\n<\/ul>\nUbuntu\u3001MacOS\u9ed8\u8ba4\u6ca1\u6709\u8bbe\u7f6eroot\u5bc6\u7801\uff0c\u8c37\u6b4c\u4e91\u3001AWS\u7684VPS\u9ed8\u8ba4\u662f\u666e\u901a\u7528\u6237\u5bc6\u94a5\u767b\u5f55\uff0c\u8981\u60f3\u5207\u6362\u5230root\u73af\u5883\uff0csudo\u00a0<\/span>-<\/span>i<\/span><\/code>\uff0c\u7136\u540e\u8f93\u5165\u7528\u6237\u5bc6\u7801\u4fbf\u8fdb\u5165\u5230\u4e86root\u73af\u5883\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"su\u548csudo\u662f\u4e24\u4e2a\u6700\u5e38\u7528\u7684\u5207\u6362\u5230root\u8d85\u7ea7\u7528\u6237\u7684Linux\u547d\u4ee4\u3002\u867d\u7136\u770b\u8d77\u6765\u5f88\u50cf\uff0c\u529f\u80fd\u4e0a\u4e5f\u7c7b\u4f3c\uff0c\u4f46\u4f7f\u7528\u4e0a\u8fd8\u662f […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,2],"tags":[1341,1342,1343],"class_list":["post-4205","post","type-post","status-publish","format-standard","hentry","category-jiaocheng","category-wljs","tag-sudo","tag-su","tag-susudo"],"_links":{"self":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/4205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/comments?post=4205"}],"version-history":[{"count":0,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/4205\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/media?parent=4205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/categories?post=4205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/tags?post=4205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}