centos普通用户权限问题解决:hadoop is not in the sudoers file. This incident will be reported.

我在centos下有一个普通用户hadoop,在用hadoop创建文件夹:

[hadoop@localhost  /] sudo mkdir  /soft

[sudo] password for hadoop: 

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

问题解决方法:

转换到root用户,使用su root命令,然后输入密码

[hadoop@localhost /]$ su root

Password: 

进入 root用户后,打开终端,给sudoers赋予修改的权限:

[root@localhost /]# chmod a+x /etc/sudoers

输入vim /etc/sudoers命令,打开sudoers文件,找到root ALL=(ALL)  ALL,在其下面一行添加你的普通用户,我的普通用户是hadoop,则添加 hadoop ALL=(ALL)  ALL,记住这里是你的linux普通用户名

[root@localhost /]# vim /etc/sudoers

## Allow root to run any commands anywhere 
root    ALL=(ALL)       ALL

hadoop   ALL=(ALL)       ALL

强制保存退出,wq!,要注意此处的wq后要加一个!号,否则会提示E45:'readonly' option is set(add ! to override)。

保存退出后,转换到hadoop用户,就可以用hadoop用户创建文件夹了

[hadoop@localhost /]$ sudo mkdir /soft
[sudo] password for hadoop: 
[hadoop@localhost /]$ ls
bin   dev  home  lost+found  mnt  proc  sbin     soft  sys  usr

boot  etc  lib   media       opt  root  selinux  srv   tmp  var


追加: 

配置hadoop权限后,以后普通用户就可以用sudo命令修改配置文件了

如安装hadoop

1.选择适合版本下载

下载地址:http://mirror.bit.edu.cn/apache/hadoop/common/

2. 拷贝到linux下,在对应目录解压文件

解压: [hadoop@localhost /]tar zxvf hadoop-3.0.3.tar.gz 

创建快捷方式,将hadoop-3.0.3创建快捷方式 hadoop

[hadoop@localhost /] ln -s hadoop-3.0.3 hadoop

    

[hadoop@localhost /] sudo /etc/profile

在文件中添加如下:

export HADOOP_HOME=/soft/hadoop

export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin

按ctrl+x保存,按Y,再回车保存成功。

使配置文件生效:

[hadoop@localhost /]   source /etc/profile



猜你喜欢

转载自blog.csdn.net/nengyu/article/details/80852523