普通用户执行sudo报hadoop is not in the sudoers file

今天在用普通用户执行sudo命令时报错如下:

hadoop is not in the sudoers file. This incident will be reported.

实测解决方式如下:

1,root用户登录。  

2,进入到/etc目录。

3,执行chmod u+w /etc/sudoers给sudoers文件增加write权限。

4,执行vim sudoers 找到root ALL=(ALL) ALL这一行,一下面增加hadoopALL=(ALL) ALL(注:hadoop为普通用户的用户名)                                      

5,执行命令chmod u-w sudoers,撤销write权限。,

6,登录hadoop用户,进行测试。比如sudo cd /root 如果成功进入 /root目录说明配置成功

原文地址:https://www.cnblogs.com/leibg/p/5302900.html