Centos普通用户权限报错:** is not in the sudoers file. This incident will be reported.
2023-09-11 14:14:47 时间
在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
相关文章
- Ubuntu用apt安装centOS用yum安装
- (转)CentOS 7安装TCP BBR拥塞算法
- centos 8.2 指南
- 在CentOS 6.4中支持exfat格式的U盘
- Centos 7.4忘记密码的情况下,修改root密码
- Centos 7.x编译安装RocksDB
- 利用Dockerfile构建一个基于CentOS 7镜像
- Centos PHP+Apache执行exec()等Linux脚本权限设置的详细步骤
- CentOS 7 添加win7启动项——修改默认启动项
- Centos root权限的变化
- CentOS编译安装emacs 25.3 错误 make: *** No targets specified and no makefile found. Stop.
- Elasticsearch索引(company)_Centos下CURL增删改