帮你解决Linux遇到xxx is not in the sudoers file. This incident will be reported.的问题

  • Post author:
  • Post category:linux


在Linux遇到这个问题的原因是普通用户没有这个权限,只要修改


/etc/sudoers


文件中的权限就可以了,具操作步骤如下。

1.首先切换到超级用户(root)


2.修改sudoers文件的权限


因为该文件

默认是只读

的,所以给他增加可写的权限

修改前:

指向指令:chmod u+w /etc/sudoers

3.编辑sudoers文件

指令:nano /etc/sudoers

在文件中找到


## Allow root to run any commands anywhere


然后再root下面按照root的格式写上语句


xxx   ALL=(ALL)  ALL,xxx表示的是你的用户名。


4.保存该文件,撤销sudoers文件的写权限,最后切换到原来的用户。

chmod  u-w   /ets/sudoers,



版权声明:本文为m0_56695823原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。