我们通常都是以普通用户登录linux, 在执行sudo时候会遇到 xxx is not in the sudoers file. This incident will be reported。
解决方法如下
1、首先要切换到root账户
$su -
(注意有- ,这和su是不同的,在用命令"su"的时候只是切换到root,但没有把root的环境变量传过去,还是当前用户的环境变量,用"su -"命令将环 境变量也一起带过去,就象和root登录一样)
2、$visudo 注意没有空格
在文件最后添加如下:
your_user_name ALL=(ALL) ALL
这样应该就加入到sudo组了,退回到普通用户下执行sudo