{"id":280,"date":"2013-01-09T18:02:43","date_gmt":"2013-01-09T18:02:43","guid":{"rendered":"https:\/\/shan.info\/new\/add-a-user-to-the-sudoers\/"},"modified":"2013-01-09T18:02:43","modified_gmt":"2013-01-09T18:02:43","slug":"add-a-user-to-the-sudoers","status":"publish","type":"post","link":"https:\/\/shan.info\/new\/add-a-user-to-the-sudoers\/","title":{"rendered":"add a user to the sudoers linux\u4e3a\u7528\u6237\u6dfb\u52a0sudo\u6743\u9650"},"content":{"rendered":"<p>\n\t&nbsp;<\/p>\n<pre style=\"margin-top: 0px; margin-bottom: 10px; padding: 5px; border: 0px; font-size: 14px; vertical-align: baseline; background-color: rgb(224, 224, 224); overflow: auto; width: auto; max-height: 600px; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); line-height: 17px;\">\r\n<\/pre>\n<p>\n\t<span style=\"color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px;\">\u7528sudo\u65f6\u63d0\u793a&#8221;xxx is not in the sudoers file. This incident will be reported.\u5176\u4e2dXXX\u662f\u4f60\u7684\u7528\u6237\u540d\uff0c\u4e5f\u5c31\u662f\u4f60\u7684\u7528\u6237\u540d\u6ca1\u6709\u6743\u9650\u4f7f\u7528sudo,\u6211\u4eec\u53ea\u8981\u4fee\u6539\u4e00\u4e0b\/etc\/sudoers\u6587\u4ef6\u5c31\u884c\u4e86\u3002\u4e0b\u9762\u662f\u4fee\u6539\u65b9 \u6cd5\uff1a<\/span><br style=\"color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px;\" \/><br \/>\n\t<br style=\"color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px;\" \/><br \/>\n\t<span style=\"color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px;\">1\uff09\u8fdb\u5165\u8d85\u7ea7\u7528\u6237\u6a21\u5f0f\u3002\u4e5f\u5c31\u662f\u8f93\u5165&#8221;su -&#8220;,\u7cfb\u7edf\u4f1a\u8ba9\u4f60\u8f93\u5165\u8d85\u7ea7\u7528\u6237\u5bc6\u7801\uff0c\u8f93\u5165\u5bc6\u7801\u540e\u5c31\u8fdb\u5165\u4e86\u8d85\u7ea7\u7528\u6237\u6a21\u5f0f\u3002\uff08\u5f53\u7136\uff0c\u4f60\u4e5f\u53ef\u4ee5\u76f4\u63a5\u7528root\u7528\uff09&nbsp;<\/span><br style=\"color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px;\" \/><br \/>\n\t<span style=\"color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px;\">2\uff09\u6dfb\u52a0\u6587\u4ef6\u7684\u5199\u6743\u9650\u3002\u4e5f\u5c31\u662f\u8f93\u5165\u547d\u4ee4&#8221;chmod u+w \/etc\/sudoers&#8221;\u3002&nbsp;<\/span><br style=\"color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px;\" \/><br \/>\n\t<span style=\"color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px;\">3\uff09\u7f16\u8f91\/etc\/sudoers\u6587\u4ef6\u3002\u4e5f\u5c31\u662f\u8f93\u5165\u547d\u4ee4&#8221;vim \/etc\/sudoers&#8221;,\u8f93\u5165&#8221;i&#8221;\u8fdb\u5165\u7f16\u8f91\u6a21\u5f0f\uff0c\u627e\u5230\u8fd9\u4e00 \u884c\uff1a&#8221;root ALL=(ALL) ALL&#8221;\u5728\u8d77\u4e0b\u9762\u6dfb\u52a0&#8221;xxx ALL=(ALL) ALL&#8221;(\u8fd9\u91cc\u7684xxx\u662f\u4f60\u7684\u7528\u6237\u540d)\uff0c\u7136\u540e\u4fdd\u5b58\uff08\u5c31\u662f\u5148\u6309\u4e00 \u4e0bEsc\u952e\uff0c\u7136\u540e\u8f93\u5165&#8221;:wq&#8221;\uff09\u9000\u51fa\u3002&nbsp;<\/span><br style=\"color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px;\" \/><br \/>\n\t<span style=\"color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px;\">4\uff09\u64a4\u9500\u6587\u4ef6\u7684\u5199\u6743\u9650\u3002\u4e5f\u5c31\u662f\u8f93\u5165\u547d\u4ee4&#8221;chmod u-w \/etc\/sudoers&#8221;\u3002<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; \u7528sudo\u65f6\u63d0\u793a&#8221;xxx is not in the sudoers file. This incident will be reported.\u5176\u4e2dXXX\u662f\u4f60\u7684\u7528\u6237\u540d\uff0c\u4e5f\u5c31\u662f\u4f60\u7684\u7528\u6237\u540d\u6ca1\u6709\u6743\u9650\u4f7f\u7528sudo,\u6211\u4eec\u53ea\u8981\u4fee\u6539\u4e00\u4e0b\/etc\/sudoers\u6587\u4ef6\u5c31\u884c\u4e86\u3002\u4e0b\u9762\u662f\u4fee\u6539\u65b9 \u6cd5\uff1a 1\uff09\u8fdb\u5165\u8d85\u7ea7\u7528\u6237\u6a21\u5f0f\u3002\u4e5f\u5c31\u662f\u8f93\u5165&#8221;su -&#8220;,\u7cfb\u7edf\u4f1a\u8ba9\u4f60\u8f93\u5165\u8d85\u7ea7\u7528\u6237\u5bc6\u7801\uff0c\u8f93\u5165\u5bc6\u7801\u540e\u5c31\u8fdb\u5165\u4e86\u8d85\u7ea7\u7528\u6237\u6a21\u5f0f\u3002\uff08\u5f53\u7136\uff0c\u4f60\u4e5f\u53ef\u4ee5\u76f4\u63a5\u7528root\u7528\uff09&nbsp; 2\uff09\u6dfb\u52a0\u6587\u4ef6\u7684\u5199\u6743\u9650\u3002\u4e5f\u5c31\u662f\u8f93\u5165\u547d\u4ee4&#8221;chmod u+w \/etc\/sudoers&#8221;\u3002&nbsp; 3\uff09\u7f16\u8f91\/etc\/sudoers\u6587\u4ef6\u3002\u4e5f\u5c31\u662f\u8f93\u5165\u547d\u4ee4&#8221;vim \/etc\/sudoers&#8221;,\u8f93\u5165&#8221;i&#8221;\u8fdb\u5165\u7f16\u8f91\u6a21\u5f0f\uff0c\u627e\u5230\u8fd9\u4e00 \u884c\uff1a&#8221;root ALL=(ALL) ALL&#8221;\u5728\u8d77\u4e0b\u9762\u6dfb\u52a0&#8221;xxx ALL=(ALL) ALL&#8221;(\u8fd9\u91cc\u7684xxx\u662f\u4f60\u7684\u7528\u6237\u540d)\uff0c\u7136\u540e\u4fdd\u5b58\uff08\u5c31\u662f\u5148\u6309\u4e00 \u4e0bEsc\u952e\uff0c\u7136\u540e\u8f93\u5165&#8221;:wq&#8221;\uff09\u9000\u51fa\u3002&nbsp; 4\uff09\u64a4\u9500\u6587\u4ef6\u7684\u5199\u6743\u9650\u3002\u4e5f\u5c31\u662f\u8f93\u5165\u547d\u4ee4&#8221;chmod u-w \/etc\/sudoers&#8221;\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[],"class_list":["post-280","post","type-post","status-publish","format-standard","hentry","category-centos-6"],"_links":{"self":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts\/280","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/comments?post=280"}],"version-history":[{"count":0,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts\/280\/revisions"}],"wp:attachment":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/media?parent=280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/categories?post=280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/tags?post=280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}