用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. 4.翻译系列:EF 6 Code-First默认约定(EF 6 Code-First系列)

    原文地址:http://www.entityframeworktutorial.net/code-first/code-first-conventions.aspx EF 6 Code-First系列 ...

  2. 第三部分:Android 应用程序接口指南---第二节:UI---第三章 菜单

    第3章 菜单 在许多不同类型的应用中,菜单通常是一种用户界面组件.为了提供给用户提供熟悉且一致的体验,你需要使用菜单API来展示用户动作和你Activity中的其他选项. 从安卓3.0系统(API l ...

  3. ③NuPlayer播放框架之类NuPlayer源码分析

    [时间:2016-10] [状态:Open] [关键词:android,nuplayer,开源播放器,播放框架] 0 引言 差不多一个月了,继续分析AOSP的播放框架的源码.这次我们需要深入分析的是N ...

  4. python开发-与其他语言的比较

    1.关于函数 1)不需要指定返回类型,不需要指定是否有返回值,每个函数都有返回值,没有的话,就返回None 2)参数也可以不指定类型,可以有默认参数,但是必须放到最后,调用的时候指定参数的值,和顺序无 ...

  5. spring aop 之annotation

    1.CutPointInterface public interface CutPointInterface { void method(); } 2.CutPointClass @Component ...

  6. 【emWin】例程二十三:窗口对象——Graph

    简介: 图形小工具可用于可视化数据.图形小工具的典型应用是显示测量值或函数图形的曲线,可同时显 示多条曲线.可使用水平和垂直刻度来标记曲线.可在背景上显示具有不同水平和垂直间距的网格.如 果数据阵列不 ...

  7. javascript and jquery 代码块

    1.5秒隐藏 (setTimeout ) setTimeout( function(){ $('.ad_midd').slideUp(); } , 5000 )

  8. windows下svn钩子实现每次提交更新至web目录

    目的 找 到SVN Server中的仓库(Repositories)文件夹的位置,在相应的项目文件夹中找到hooks文件夹.在该文件夹中添加一个post- commit文件:当有commit动作发生时 ...

  9. c# 根据字段名,得到对象中的属性值

    public string GetModelValue(string FieldName, object obj) { try { Type Ts = obj.GetType(); object o ...

  10. 服务器最大TCP连接数及调优汇总

    启动线程数: 启动线程数=[任务执行时间/(任务执行时间-IO等待时间)]*CPU内核数 最佳启动线程数和CPU内核数量成正比,和IO阻塞时间成反比.如果任务都是CPU计算型任务,那么线程数最多不超过 ...