转载请注明出处:https://blog.csdn.net/l1028386804/article/details/93380235

当在终端执行sudo命令时,系统提示“cuser is not in the sudoers file”:

具体报错信息为:

-bash-4.1$ sudo vim /etc/profile

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for hadoop: 
hadoop is not in the sudoers file.  This incident will be reported.

其实就是没有权限进行sudo,解决方法如下(这里假设用户名是hadoop):

1.切换到root用户:$ su

2.打开/etc/sudoers文件:$vim /etc/sudoers

3.修改文件内容:

找到“root    ALL=(ALL)       ALL”一行,在下面插入新的一行,内容是“hadoop    ALL=(ALL)       ALL”,

然后在vim键入命令“wq!”保存并退出。

注:这个文件是只读的,不加“!”保存会失败。

4.退出root用户:$ exit

 

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐