用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. VS中项目的循环引用的问题

    这个道理很简单,要编译A,首先要编译A引用的项目B,要编译项目B,必须首先编译B引用的项目A. 那么你说应该先编译哪个项目. 如果你非要循环引用,你不要让A引用项目B,而是直接引用项目B生成的b.dl ...

  2. [转]抛弃jQuery,使用原生JavaScript

    原文链接 Document Ready 事件 在jQuery中,document.ready可以让代码在整个文档加载完毕之后执行: $(document).ready(function() { // ...

  3. Nginx实现url请求不区分大小写

    原文地址:http://blog.linuxeye.com/382.html 如果你将跑在Windows下的项目(如:php)迁移到Linux下,由于Windows操作系统中,文件名是不区分大小写的: ...

  4. 高性能Javascript(1)

    第一部分 加载与运行 <html> <head> <title>Script Example</title> </head> <bod ...

  5. Easyui-DataGrid 分页多选框 及 遍历所有选中项

    html <table id='grid' class='easyui-datagrid' style='height:500px' url='Ajax-index.php?module=< ...

  6. iOS中如何创建一个滑出式导航面板(1)

    本文将介绍如何创建类似Facebook和Path iOS程序中的滑出式导航面板. 向右滑动 滑出式设计模式可以让开发者在程序中添加常用的导航功能,又不会浪费屏幕上宝贵的空间.用户可以在任意时间滑出导航 ...

  7. 解决python-memcache报错:“Unknown flags on get: 20”

    [本文出自天外归云的博客园] 在使用python的pytho-memcache库时出现了一个问题,在调用get方法获取键值的时候报错:Unknown flags on get: 20 在网上查了,发现 ...

  8. centos 7 配置tomcat开机启动

    1. tomcat 需要增加一个pid文件 在tomca/bin 目录下面,增加 setenv.sh 配置,catalina.sh启动的时候会调用,同时配置java内存参数. #add tomcat ...

  9. stm32+rx8025

    // 设备读写地址 #define        RX8025_ADDR_READ                0x65 #define        RX8025_ADDR_WRITE       ...

  10. React Native - FlexBox弹性盒模型

    FlexBox布局 1. 什么是FlexBox布局?   弹性盒模型(The Flexible Box Module),又叫FlexBox,意为"弹性布局",旨在通过弹性的方式来对 ...