码迷,mamicode.com
首页 > 系统相关 > 详细

Linux中普通用户用sudo执行命令时报”xxx is not in the sudoers file.This incident will be reported”错误

时间:2019-02-20 10:02:00      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:root   reported   执行   操作   时报   编辑   可见   命令   mod   

Linux中普通用户用sudo执行命令时报”xxx is not in the sudoers file.This incident will be reported”错误,解决方法就是在/etc/sudoers文件里给该用户添加权限。如下:

1.切换到root用户下
  方法为直接在命令行输入:su,然后输入密码(即你的登录密码,且密码默认不可见)。

2./etc/sudoers文件默认是只读的,对root来说也是,因此需先添加sudoers文件的写权限,命令是:
即执行操作:chmod u+w /etc/sudoers

3.编辑sudoers文件
即执行:vi /etc/sudoers
找到这行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (这里的xxx是你的用户名)

ps:这里说下你可以sudoers添加下面四行中任意一条
youuser ALL=(ALL) ALL
%youuser ALL=(ALL) ALL
youuser ALL=(ALL) NOPASSWD: ALL
%youuser ALL=(ALL) NOPASSWD: ALL

第一行:允许用户youuser执行sudo命令(需要输入密码).
第二行:允许用户组youuser里面的用户执行sudo命令(需要

Linux中普通用户用sudo执行命令时报”xxx is not in the sudoers file.This incident will be reported”错误

标签:root   reported   执行   操作   时报   编辑   可见   命令   mod   

原文地址:https://www.cnblogs.com/dwtmjps/p/10404505.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!