{"id":270786,"date":"2023-04-28T04:03:23","date_gmt":"2023-04-27T20:03:23","guid":{"rendered":"https:\/\/gulass.cn\/lxtzptyhzxtd.html"},"modified":"2023-04-28T04:03:23","modified_gmt":"2023-04-27T20:03:23","slug":"lxtzptyhzxtd","status":"publish","type":"post","link":"https:\/\/gulass.cn\/lxtzptyhzxtd.html","title":{"rendered":"Linux\u7cfb\u7edf\u4e2d\u666e\u901a\u7528\u6237\u6267\u884c\u7279\u5b9a\u7684\u7cfb\u7edf\u7ba1\u7406\u547d\u4ee4\u548cvim\u6267\u884c\u547d\u4ee4"},"content":{"rendered":"

\u5728Linux<\/a>\u7cfb\u7edf<\/a>\u4e2d\u666e\u901a\u7528\u6237\u5728\u4f7f\u7528\u7cfb\u7edf\u8d44\u6e90\u65f6\u76f8\u5bf9\u4e8eroot\u8d85\u7ea7\u7528\u6237\u4f1a\u6709\u597d\u591a\u7684\u9650\u5236\u3002\u8bf8\u5982\uff0c\u5207\u6362\u5230\u666e\u901a\u7528\u6237\u8eab\u5206\u4e0b\u6302\u8f7d\u786c\u76d8\uff0c\u4f1a\u62a5\u5982\u4e0b\u9519\u8bef\uff0c\u5982\u53f3\u56fe\u6240\u793a\u3002<\/p>\n

linux\u7cfb\u7edf\u7528\u6237\u6743\u9650\u7ba1\u7406_linux oracle\u7528\u6237 \u6743\u9650_linux\u7ed9\u7528\u6237\u5206\u914d\u6743\u9650<\/p>\n

\u8fd9\u662f\u7531\u4e8e\u5728Linux\u4e2dlinux\u7cfb\u7edf\u7528\u6237\u6743\u9650\u7ba1\u7406<\/strong>\uff0c\u597d\u591a\u7cfb\u7edf\u7ba1\u7406\u547d\u4ee4<\/a>\u666e\u901a\u7528\u6237\u662f\u65e0\u6743\u4f7f\u7528\u7684\uff0c\u82e5\u679c\u51c6\u8bb8\u7279\u5b9a\u7528\u6237\u6267\u884c\u4e2a\u522b\u7279\u5b9a\u7684\u7cfb\u7edf\u7ba1\u7406\u547d\u4ee4linux\u8fd0\u7ef4\u6700\u4f73\u5b9e\u8df5\uff0c\u5c31\u987b\u8981\u5bf9\u666e\u901a\u7528\u6237\u6388\u6743\u3002\u4f7f\u5176\u80fd\u6267\u884c\u7279\u5b9a\u7684\u7cfb\u7edf\u7ba1\u7406\u547d\u4ee4\u3002\u5982\u4e0a\u8ff0\u7684\u666e\u901a\u7528\u6237\u201cmoon\u201dlinux\u7cfb\u7edf\u7528\u6237\u6743\u9650\u7ba1\u7406<\/strong>\uff0c\u82e5\u51c6\u8bb8\u5176\u6267\u884c\u6302\u8f7d\u5149\u789f\u7684\u547d\u4ee4\uff0c\u5c31\u987b\u8981\u5bf9\u201cmoon\u201d\u7528\u6237\u6388\u4e88\u6267\u884c\u6302\u8f7d\u5149\u789f\u547d\u4ee4\u7684\u6743\u9650\u3002\u4e3a\u4e86\u5206\u8fa8\u666e\u901a\u7528\u6237\u6267\u884c\u7684\u662f\u666e\u901a\u64cd\u4f5c\u547d\u4ee4\u8fd8\u662f\u5f97\u5230\u6388\u6743\u7684\u7cfb\u7edf\u7ba1\u7406\u547d\u4ee4\uff0cLinux\u7cfb\u7edf\u4e2d\u5bf9\u666e\u901a\u7528\u6237\u6267\u884c\u7684\u547d\u4ee4\u8fdb\u884c\u4e86\u754c\u5b9a\uff0c\u6267\u884c\u666e\u901a\u64cd\u4f5c\u547d\u4ee4\u65f6\uff0c\u76f4\u63a5\u8f93\u5165\u547d\u4ee4;\u6267\u884c\u5f97\u5230\u6388\u6743\u7684\u7cfb\u7edf\u7ba1\u7406\u547d\u4ee4\u65f6\uff0c\u547d\u4ee4\u524d\u52a0sudo\u3002\u5982\u4e0a\u8ff0\u201cmoon\u201d\u7528\u6237\u5f97\u5230\u6302\u8f7d\u5149\u789f\u7684\u6388\u6743\uff0c\u5176\u6267\u884c\u4e0b\u8ff0\u547d\u4ee4\u5373\u53ef\u6302\u8f7d\u5149\u789f\uff1a<\/p>\n

[moon@centos7-1~]$sudomount\/dev\/cdrom\/media<\/p>\n

\u4e3a\u6b64\uff0c\u6d45\u663e\u7684\u79f0\u8fd9\u4e9b\u6388\u6743\u4e3asudo\u6388\u6743\u3002<\/p>\n

\u4fdd\u5b58sudo\u6388\u6743\u7684\u914d\u7f6e\u6587\u4ef6\u662f\/etc\/sudoers\u3002\u5bf9\u8be5\u6587\u4ef6\u8fdb\u884c\u4fee\u6539\uff0c\u5373\u662fsudo\u6388\u6743\u3002\u4f46Linux\u4e0d\u51c6\u8bb8\u76f4\u63a5\u5bf9\u8be5\u6587\u4ef6\u8fdb\u884c\u66f4\u6539\uff0c\u800c\u662f\u63d0\u4f9b\u4e86\u4e13\u7528\u4e8e\u66f4\u6539\u8be5\u6587\u4ef6\u7684\u64cd\u4f5c\u547d\u4ee4visudo\u3002root\u7528\u6237\u4f7f\u7528visudo\u547d\u4ee4\u7f16\u8f91\u4fee\u6539\/etc\/sudoers\u6587\u4ef6\u3002<\/p>\n

(1)\u914d\u7f6esudo\u6388\u6743<\/p>\n

sudo\u6388\u6743\u7684\u6b65\u9aa4\u5982\u4e0b\u3002<\/p>\n

\u2460\u8f93\u5165su-root\uff0c\u5207\u6362\u5230\u7528\u6237root\u4e0b\u3002<\/p>\n

\u2461\u4f7f\u7528visudo\u547d\u4ee4\u6253\u5f00sudo\u7f16\u8f91\u754c\u9762\u5bf9\/etc\/sudoers\u6587\u4ef6\u8fdb\u884c\u7f16\u8f91\uff0c\u5982\u53f3\u56fe\u6240\u793a\u3002<\/p>\n

\u8f93\u5165visudo\u540e\u4f1a\u5448\u73b0\u5982\u53f3\u56fe\u5de6\u8fb9\u7a97\u53e3\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u5f00\u59cb\u7f16\u8f91\u3002visudo\u547d\u4ee4\u548cvim\u547d\u4ee4\u4f7f\u7528\u65b9\u6cd5\u65b9\u5f0f\u76f8\u540c\u3002\u8054\u901a\u5149\u6807\uff0c\u627e\u5230\u53f3\u56fe\u53f3\u8fb9\u6240\u793a\u7684\u5185\u5bb9\u3002<\/p>\n

linux\u7ed9\u7528\u6237\u5206\u914d\u6743\u9650_linux oracle\u7528\u6237 \u6743\u9650_linux\u7cfb\u7edf\u7528\u6237\u6743\u9650\u7ba1\u7406<\/p>\n

\u56fe\u793a\u4e2d\u53e5\u5b50rootALL=(ALL)ALL\u8868\u793a\u5bb9\u8bb8\u7528\u6237root\u5728\u4efb\u4f55\u4e3b\u673a(\u5305\u62ec\u672c\u673a)\u4e0a\u6267\u884c\u6240\u6709\u547d\u4ee4\uff0c\u5728\u8fd9\u4e00\u884c\u53e5\u5b50\u7684\u4e0b\u6dfb\u52a0\u6ee1\u8db3\u4ee5\u4e0b\u683c\u5f0f\u7684\u4e00\u884c\u53e5\u5b50\u5373\u53ef\u3002<\/p>\n

\u53e5\u5b50\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n

\u7528\u6237\u4e3b\u673a\u540d=(\u4ee5\u90a3\u4e2a\u7528\u6237\u7684\u8eab\u5206)\u547d\u4ee4\u7684\u7edd\u5bf9\u8def\u5f84<\/p>\n

\u56fe\u4e2d\u7ea2\u6846\u5185\u7684\u5185\u5bb9\u662f\u65b0\u964d\u4f4e\u7684\u914d\u7f6e\u3002<\/p>\n

zhangcentos7-1=(root)\/usr\/bin\/mount,\/usr\/bin\/umount\u8868\u793a\u7ed9\u7528\u6237zhang\u8fdb\u884csudo\u6388\u6743\uff0c\u51c6\u8bb8\u5176\u5728centos7-1\u4e3b\u673a\u4e0a\u4ee5root\u7684\u8eab\u5206\u6267\u884cmount\u548cumount\u547d\u4ee4\u3002<\/p>\n

\u6ce8\u610f\uff0c\u547d\u4ee4\u5fc5\u987b\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\uff0c\u82e5\u5bf9\u547d\u4ee4\u7684\u7edd\u5bf9\u8def\u5f84\u4e0d\u6e05\u695a\u53ef\u4ee5\u4f7f\u7528whereis\u547d\u4ee4\u67e5\u770b\u3002<\/p>\n

\u2462\u4fdd\u5b58\u9000\u51fa\u5373\u53ef\u3002<\/p>\n

\u6ce8\u610f\uff0c\u7528visudo\u547d\u4ee4\u7f16\u8f91\u7684\u662f\/etc\/sudoers\u914d\u7f6e\u6587\u4ef6\uff0c\u5c06\u6388\u6743\u7684\u666e\u901a\u7528\u6237\u5199\u5728\u8be5\u914d\u7f6e\u6587\u4ef6\u4e2d\u53ef\u4ee5\u4f7f\u8be5\u7528\u6237\u8fd0\u884c\u987b\u8981root\u6743\u9650\u7684\u547d\u4ee4\u3002<\/p>\n

(2)\u9a8c\u8bc1\u914d\u7f6e\u7ed3\u679c<\/p>\n

\u5207\u6362\u5230\u666e\u901a\u7528\u6237zhang\u8eab\u5206\u4e0b\u8fdb\u884c\u9a8c\u8bc1\uff0c\u6b65\u9aa4\u5982\u4e0b\u3002<\/p>\n

\u2460\u5207\u6362\u5230\u7528\u6237zhang\u72b6\u6001\u4e0b\uff0c\u8f93\u5165su-zhang\u3002<\/p>\n

\u2461\u8f93\u5165\u547d\u4ee4[zhang@Centos7-1~]sudomount\/dev\/cdrom\/media\uff0c\u4f1a\u63d0\u793a\u8f93\u5165zhang\u7684\u5bc6\u7801\uff0c\u9a8c\u8bc1\u6210\u529f\u540e\uff0c\u5219\u547d\u4ee4\u6210\u529f\u6267\u884c\u3002<\/p>\n

\u666e\u901a\u7528\u6237zhang\u9ed8\u8ba4\u6ca1\u6709\u6743\u9650\u4f7f\u7528mount\u6302\u8f7d\u547d\u4ee4\uff0c\u4f46root\u7528\u6237\u901a\u8fc7\u4f7f\u7528visudo\u547d\u4ee4\u914d\u7f6e\/etc\/sudoers\u914d\u7f6e\u6587\u4ef6\u4f7f\u7528\u6237zhang\u62e5\u6709\u4e86\u4f7f\u7528mount\u547d\u4ee4\u7684\u6743\u9650(mount\u547d\u4ee4\u672c\u6765\u53ea\u6709root\u7528\u6237\u80fd\u591f\u4f7f\u7528)\u3002\u53ea\u662f\u7528\u6237zhang\u5728\u4f7f\u7528mount\u547d\u4ee4\u65f6\uff0c\u987b\u8981\u5728mount\u547d\u4ee4\u540e\u9762\u52a0\u4e0asudo\u547d\u4ee4\uff0c\u8868\u793a\u7528\u6237zhang\u5148\u5316\u8eab\u6210\u4e3aroot\uff0c\u4e4b\u540e\u518d\u6267\u884cmount\u547d\u4ee4\u3002\u5982\u53f3\u56fe\u6240\u793a\u3002<\/p>\n

(3)\u8bbe\u7f6e\u547d\u4ee4\u522b\u79f0<\/p>\n

\u5728\u66f4\u6539\/etc\/sudoers\u6587\u4ef6\u8fdb\u884csudo\u6388\u6743\u65f6\uff0c\u8fd8\u53ef\u4ee5\u628a\u591a\u4e2a\u547d\u4ee4\u8bbe\u7f6e\u6210\u4e3a\u547d\u4ee4\u522b\u79f0\uff0c\u5373\u628a\u591a\u4e2a\u547d\u4ee4\u52a0\u5165\u5230\u4e00\u4e2a\u547d\u4ee4\u96c6\u5408\u4e2d\uff0c\u4fbf\u4e8e\u5c06\u547d\u4ee4\u96c6\u5408\u591a\u6b21\u6388\u6743\u7ed9\u4e0d\u540c\u7684\u7528\u6237\u4f7f\u7528\uff0c\u7b80\u5316\u6388\u6743\u7684\u8bbe\u7f6e\u3002<\/p>\n

\u8bbe\u7f6e\u547d\u4ee4\u522b\u79f0\u7684\u6b65\u9aa4\u5982\u4e0b\u3002<\/p>\n

\u2460\u7f16\u8f91\/etc\/sudoers\u6587\u4ef6linux\u7cfb\u7edf\uff0c\u8f93\u5165\u547d\u4ee4visudo(\u76f8\u5f53\u4e8evi\/etc\/sudoers)\uff0c\u4e4b\u540e\u8f93\u5165\u201ci\u201d\uff0c\u6b65\u5165\u63d2\u5165\u6a21\u5f0f\uff0c\u5f00\u59cb\u7f16\u8f91\u3002<\/p>\n

\u2461\u8f93\u5165Cmnd_AliasGUAZAI=\/usr\/bin\/mount,\/usr\/bin\/umount\uff0c\u8bbe\u5b9a\u547d\u4ee4\u522b\u79f0\uff0c\u5373\u628a\u591a\u4e2a\u547d\u4ee4\u7ec4\u6210\u4e00\u4e2a\u547d\u4ee4\u96c6\u3002\u6ce8\u610f\uff0c\u522b\u79f0\u5fc5\u987b\u5c0f\u5199\u3002<\/p>\n

\u2462\u8f93\u5165zhangcentos7-1=GUAZAI\uff0c\u6388\u4e88\u7528\u6237zhang\u6267\u884cmount\u548cumount\u547d\u4ee4\u7684\u6743\u9650\u3002<\/p>\n

\u2463\u8f93\u5165%g1centos7-1=(root)GUAZAI\uff0c\u201c%\u201d\u7528\u4e8e\u7ed9\u7ec4\u6388\u6743\uff0c\u8868\u793a\u7ed9\u7ec4g1\u7684\u6210\u5458\u6388\u4e88\u6267\u884csudo\u7684\u547d\u4ee4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u8fd9\u662f\u56e0\u4e3a\u5728Linux\u4e2d\uff0c\u5f88\u591a\u7cfb\u7edf\u7ba1\u7406\u547d\u4ee4\u666e\u901a\u7528\u6237\u662f\u65e0\u6743\u4f7f\u7528\u7684\uff0c\u82e5\u60f3\u5141\u8bb8\u7279\u5b9a\u7528\u6237\u6267\u884c\u67d0\u4e9b\u7279\u5b9a\u7684\u7cfb\u7edf\u7ba1\u7406\u547d\u4ee4\uff0c\u5c31\u9700\u8981\u5bf9\u666e\u901a\u7528\u6237\u6388\u6743\u3002\u4f7f\u5176\u80fd\u6267\u884c\u7279\u5b9a\u7684\u7cfb\u7edf\u7ba1\u7406\u547d\u4ee4\u3002\u4e3a\u4e86\u533a\u5206\u666e\u901a\u7528\u6237\u6267\u884c\u7684\u662f\u666e\u901a\u64cd\u4f5c\u547d\u4ee4\u8fd8\u662f\u5f97\u5230\u6388\u6743\u7684\u7cfb\u7edf\u7ba1\u7406\u547d\u4ee4\uff0cLinux\u7cfb\u7edf\u4e2d\u5bf9\u666e\u901a\u7528\u6237\u6267\u884c\u7684\u547d\u4ee4\u8fdb\u884c\u4e86\u5212\u5206\uff0c\u6267\u884c\u666e\u901a\u64cd\u4f5c\u547d\u4ee4\u65f6\uff0c\u76f4\u63a5\u8f93\u5165\u547d\u4ee4;\u6267\u884c\u5f97\u5230\u6388\u6743\u7684\u7cfb\u7edf\u7ba1\u7406\u547d\u4ee4\u65f6\uff0c\u547d\u4ee4\u524d\u52a0sudo\u3002<\/p>\n","protected":false},"author":1,"featured_media":270787,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-270786","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/270786","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=270786"}],"version-history":[{"count":0,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/270786\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/270787"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=270786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=270786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=270786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}