用adduser新建的用户,当时只输入了一个用户名,没做其它操作,这样就建立了一个normal用户。在执行sudo vim hadoop-env.sh时,报“*** is not in the sudoers file.  This incident will be reported.”。

经查询,网上的解决方案大多数都是:

执行visudo或vim /etc/sudoers命令,然后在root用户下面增加<username> ALL=(ALL) ALL

我相信这样一定可以解决问题,但这是杀鸡用牛刀。看起来似乎是让这个用户和root一样拥有了全部全部全部的权限,有没有感觉瑟瑟发抖。像这样的方法,我们自己使用玩玩还可以,但这肯定不是正确的解决方法。更何况,在安装系统时建立的一个用户hadoop1,可以使用sudo,但这个用户名并不在sudoers 这个文件里,所以肯定有其它正确的方法。

后来在这里https://www.cnblogs.com/yadongliang/p/8659950.html发现了,博主所说的他没有成功的方案一,我测试成功。

sudo是个用户组,只要把用户加到这个用户组,就可以使用sudo了,这才叫解决方案。

下面是具体步骤:

切换到不能使用sudo的用户,就叫hadoop2吧,登录以后,执行groups命令,发现是空的,也就是说用adduser增加的用户,不在任何用户组里。

而安装系统时创建的用户,hadoop1则有很多用户组:

adm cdrom sudo dip plugdev lpadmin sambashare

所以,用adduser把hadoop2加到sudo用户组:

adduser hadoop2 sudo

再次执行groups,sudo用户组就出现了。

再次执行sudo vim hadoop-env.sh,成功。

解决ubuntu系统“XXX is not in the sudoers file”错误的更多相关文章

  1. Linux遇到的问题(一)Ubuntu报“xxx is not in the sudoers file.This incident will be reported” 错误解决方法

    提示错误信息 www@iZ236j3sofdZ:~$ ifconfig Command 'ifconfig' is available in '/sbin/ifconfig' The command ...

  2. ubuntu:xxx is not in the sudoers file. 问题解决

    ubuntu 下普通用户用 sudo 执行命令时报 "xxx is not in the sudoers file.This incident will be reported" ...

  3. Linux有问必答:怎样解决“XXX is not in the sudoers file”错误

    问题:我想在我的Linux系统上使用sudo来运行一些特权命令,然而当我试图这么做时,我却得到了"[我的用户名] is not in the sudoers file. This incid ...

  4. linux解决“XXX is not in the sudoers file”错误

    问题:我想在我的Linux系统上使用sudo来运行一些特权命令,然而当我试图这么做时,我却得到了"[我的用户名] is not in the sudoers file. This incid ...

  5. 解决Ubuntu系统中文乱码显示问题,终端打开文件及查看目录

    解决Ubuntu系统中文乱码显示问题 [日期:2014-02-20] 来源:Linux社区  作者:njchenyi [字体:大 中 小]   我是先安装了Ubuntu 12.04 Server,然后 ...

  6. 企业运维案例:xxx is not in the sudoers file.This incident will be reported” 错误解决方法

    CentOS6系统下,普通用户使用sudo执行命令时报错: xxx is not in the sudoers file.This incident will be reported" 解决 ...

  7. centos添加和删除用户及 xxx is not in the sudoers file.This incident will be reported.的解决方法

    修改主机名:vim /etc/sysconfig/network 1.添加用户,首先用adduser命令添加一个普通用户,命令如下: #adduser tommy //添加一个名为tommy的用户 # ...

  8. Linux sudo 错误:XXX is not in the sudoers file 解决办法

    最近在学习linux,在某个用户(xxx)下使用sudo的时候,提示以下错误:xxx is not in the sudoers file. This incident will be reporte ...

  9. 解决:xxx is not in the sudoers file.This incident will be reported.的解决方法

    Linux中普通用户用sudo执行命令时报”xxx is not in the sudoers file.This incident will be reported”错误,解决方法就是在/etc/s ...

随机推荐

  1. 基于Centos搭建Python Web 环境搭建教程

    CentOS 7.2 64 位操作系统 安装 setuptools 工具 安装 因为之后我们需要安装 Django ,而 Django 需要用这个工具,所以我们需要先安装 setuptools 工具. ...

  2. 一张图作为Python入门(图片来自网络)

  3. Docker 网络管理

    网络模式 容器网络访问原理 桥接宿主机网络和配置固定IP地址 Docker 支持五种网络模式: 1.网络模式: --net  1.1 bridge  默认网络,Docker启动后默认创建一个docke ...

  4. [k8s]k8s配置nfs做后端存储&配置多nginx共享存储&&statefulset配置

    所有节点安装nfs yum install nfs-utils rpcbind -y mkdir -p /ifs/kubernetes echo "/ifs/kubernetes 192.1 ...

  5. linux每日命令(39):lsof命令

    lsof(list open files)是一个列出当前系统打开文件的工具.在linux环境下,任何事物都以文件的形式存在,通过文件不仅仅可以访问常规数据,还可以访问网络连接和硬件.所以如传输控制协议 ...

  6. Lua 5.1 5.3 参考手册

    Lua 5.1 参考手册: https://www.codingnow.com/2000/download/lua_manual.html Lua 5.3 参考手册: http://cloudwu.g ...

  7. 基于Docker的redis集群搭建

    Redis集群官方介绍:http://www.redis.cn/topics/cluster-tutorial.html 基于Docker搭建Redis集群 环境:6个节点,三主三从 制作Redis镜 ...

  8. windowsclient开发--为你的client进行国际化

    之前博客讲过函数: GetUserDefaultUILanguage Returns the language identifier for the user UI language for the ...

  9. 【原】使用Tkinter绘制GUI并结合Matplotlib实现交互式绘图

    在数据分析的过程中,往往需要对所建立的模型进行可视化,并调整其中的某些参数. 通常情况下,在Python中可以通过Matplotlib来进行绘制图像.然而该绘制过程是静态的,也就是每次调整完参数需要重 ...

  10. C++ 智能指针六

    /* 智能指针unique_ptr */ #include <iostream> #include <string> #include <memory> #incl ...