欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

Centos普通用户权限报错:** is not in the sudoers file. This incident will be reported.

发布时间:2025/3/15 72 豆豆
生活随笔 收集整理的这篇文章主要介绍了 Centos普通用户权限报错:** 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)       ALLhadoop   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  usrboot  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 新人创作打卡挑战赛发博客就能抽奖!定制产品红包拿不停!

总结

以上是生活随笔为你收集整理的Centos普通用户权限报错:** is not in the sudoers file. This incident will be reported.的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。