{"id":204691,"date":"2020-11-16T08:45:54","date_gmt":"2020-11-16T00:45:54","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=204691"},"modified":"2020-11-03T09:05:19","modified_gmt":"2020-11-03T01:05:19","slug":"linux-sudo-config","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-sudo-config.html","title":{"rendered":"\u5206\u4eabLinux\u4e0b\u7684sudo\u53ca\u5176\u914d\u7f6e\u6587\u4ef6\/etc\/sudoers\u8be6\u7ec6\u914d\u7f6e"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86\u8be6\u89e3Linux\u4e0b\u7684sudo\u53ca\u5176\u914d\u7f6e\u6587\u4ef6\/etc\/sudoers\u7684\u8be6\u7ec6\u914d\u7f6e\u7684\u76f8\u5173\u8d44\u6599,\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n 1.sudo\u4ecb\u7ecd<\/strong><\/div>\n sudo\u662flinux\u4e0b\u5e38\u7528\u7684\u5141\u8bb8\u666e\u901a\u7528\u6237\u4f7f\u7528\u8d85\u7ea7\u7528\u6237\u6743\u9650\u7684\u5de5\u5177\uff0c\u5141\u8bb8\u7cfb\u7edf\u7ba1\u7406\u5458\u8ba9\u666e\u901a\u7528\u6237\u6267\u884c\u4e00\u4e9b\u6216\u8005\u5168\u90e8\u7684root\u547d\u4ee4\uff0c\u5982halt\uff0creboot\uff0csu\u7b49\u7b49\u3002\u8fd9\u6837\u4e0d\u4ec5\u51cf\u5c11\u4e86root\u7528\u6237\u7684\u767b\u9646 \u548c\u7ba1\u7406\u65f6\u95f4\uff0c\u540c\u6837\u4e5f\u63d0\u9ad8\u4e86\u5b89\u5168\u6027\u3002Sudo\u4e0d\u662f\u5bf9shell\u7684\u4e00\u4e2a\u4ee3\u66ff\uff0c\u5b83\u662f\u9762\u5411\u6bcf\u4e2a\u547d\u4ee4\u7684\u3002<\/p>\n \u5b83\u7684\u7279\u6027\u4e3b\u8981\u6709\u8fd9\u6837\u51e0\u70b9\uff1a<\/strong><\/span><\/div>\n 2.\u914d\u7f6e\u6587\u4ef6\/etc\/sudoers<\/strong><\/div>\n \u5b83\u7684\u4e3b\u8981\u914d\u7f6e\u6587\u4ef6\u662fsudoers,linux\u4e0b\u901a\u5e38\u5728\/etc\u76ee\u5f55\u4e0b\uff0c\u5982\u679c\u662fsolaris\uff0c\u7f3a\u7701\u4e0d\u88c5sudo\u7684\uff0c\u7f16\u8bd1\u5b89\u88c5\u540e\u901a\u5e38\u5728\u5b89\u88c5\u76ee\u5f55\u7684 etc\u76ee\u5f55\u4e0b\uff0c\u4e0d\u8fc7\u4e0d\u7ba1sudoers\u6587\u4ef6\u5728\u54ea\u513f\uff0csudo\u90fd\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7f16\u8f91\u8be5\u6587\u4ef6\u7684\u547d\u4ee4\uff1avisudo\u6765\u5bf9\u8be5\u6587\u4ef6\u8fdb\u884c\u4fee\u6539\u3002\u5f3a\u70c8\u63a8\u8350\u4f7f\u7528\u8be5\u547d\u4ee4\u4fee\u6539 sudoers\uff0c\u56e0\u4e3a\u5b83\u4f1a\u5e2e\u4f60\u6821\u9a8c\u6587\u4ef6\u914d\u7f6e\u662f\u5426\u6b63\u786e\uff0c\u5982\u679c\u4e0d\u6b63\u786e\uff0c\u5728\u4fdd\u5b58\u9000\u51fa\u65f6\u5c31\u4f1a\u63d0\u793a\u4f60\u54ea\u6bb5\u914d\u7f6e\u51fa\u9519\u7684\u3002<\/p>\n \u8a00\u5f52\u6b63\u4f20\uff0c\u4e0b\u9762\u4ecb\u7ecd\u5982\u4f55\u914d\u7f6esudoers\u9996\u5148\u5199sudoers\u7684\u7f3a\u7701\u914d\u7f6e\uff1a<\/p>\n \r\n############################################################# \r\n# sudoers file. \r\n# \r\n# This file MUST be edited with the 'visudo' command as root. \r\n# \r\n# See the sudoers man page for the details on how to write a sudoers file. \r\n# \r\n \r\n# Host alias specification \r\n \r\n# User alias specification \r\n \r\n# Cmnd alias specification \r\n \r\n# Defaults specification \r\n \r\n# User privilege specification \r\nroot ALL=(ALL) ALL \r\n \r\n# Uncomment to allow people in group wheel to run all commands \r\n# %wheel ALL=(ALL) ALL \r\n \r\n# Same thing without a password \r\n# %wheel ALL=(ALL) NOPASSWD: ALL \r\n \r\n# Samples \r\n# %users ALL=\/sbin\/mount \/cdrom,\/sbin\/umount \/cdrom \r\n# %users localhost=\/sbin\/shutdown -h now \r\n################################################################## <\/pre>\n |