说的是,这种问题,是出现在ubuntu系统里。

    

  

root@SparkSingleNode:/usr/local/jdk# pwd

/usr/local/jdk

root@SparkSingleNode:/usr/local/jdk# su spark

spark@SparkSingleNode:/usr/local/jdk$ sudo cp /home/spark/Downloads/Spark_Cluster_Software/jdk-8u60-linux-x64.tar.gz  /usr/local/jdk

[sudo] password for spark:

spark is not in the sudoers file.  This incident will be reported.

spark@SparkSingleNode:/usr/local/jdk$ ls

解决办法:

  1. 切换到root用户下

  

spark@SparkSingleNode:/usr/local/jdk$ pwd

/usr/local/jdk

spark@SparkSingleNode:/usr/local/jdk$ su root

Password:

root@SparkSingleNode:/usr/local/jdk#

  

2、/etc/sudoers文件默认是只读的,对root来说也是,因此需先添加sudoers文件的写权限,

命令是:

  chmod u+w /etc/sudoers

root@SparkSingleNode:/usr/local/jdk# chmod u+w /etc/sudoers

root@SparkSingleNode:/usr/local/jdk#

3.编辑sudoers文件

  vim /etc/sudoers

找到这行 root ALL=(ALL) ALL,在它下面添加xxx ALL=(ALL) ALL (这里的xxx是你的用户名)

ps:这里说下你可以sudoers添加下面四行中任意一条

youuser            ALL=(ALL)                ALL

%youuser           ALL=(ALL)                ALL

youuser            ALL=(ALL)                NOPASSWD: ALL

%youuser           ALL=(ALL)                NOPASSWD: ALL

第一行:允许用户youuser执行sudo命令(需要输入密码).

第二行:允许用户组youuser里面的用户执行sudo命令(需要输入密码).

第三行:允许用户youuser执行sudo命令,并且在执行的时候不输入密码.

第四行:允许用户组youuser里面的用户执行sudo命令,并且在执行的时候不输入密码.

  在这里,我就为了方便,选择第四行。日后,生产中,再去修改。

我的用户组是spark,目前spark用户组里的用户只有spark。

#

# This file MUST be edited with the 'visudo' command as root.

#

# Please consider adding local content in /etc/sudoers.d/ instead of

# directly modifying this file.

#

# See the man page for details on how to write a sudoers file.

#

Defaults        env_reset

Defaults        mail_badpass

Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification

root    ALL=(ALL:ALL) ALL

%spark  ALL=(ALL) NOPASSWD:ALL

# Members of the admin group may gain root privileges

%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command

%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

4.撤销sudoers文件写权限,命令:

  chmod u-w /etc/sudoers

这样普通用户就可以使用sudo了.

  成功!

XXX 用户 is not in the sudoers file. This incident will be reported 的问题解决方案的更多相关文章

  1. XXX is not in the sudoers file. This incident will be reported 的问题解决方案

    不多说,直接上干货! 说的是,这种问题,是出现在ubuntu系统里. root@SparkSingleNode:/usr/local/jdk# pwd /usr/local/jdk root@Spar ...

  2. XXXX is not in the sudoers file. This incident will be reported解决方法

    假设你用的是Red Hat系列(包括Fedora和CentOS)的Linux系统.当你执行sudo命令时可能会提示“某某用户 is not in the sudoers file.  This inc ...

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

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

  4. Linux中添加管理员权限问题:xxx is not in the sudoers file. This incident will be reported.

    在各个不同版本的linux中添加拥有管理员权限账户有不同的简便方式. 问题: 今天遇见将新添用户添加到root用户组后,运行sudo仍然提示 ”xxx is not in the sudoers fi ...

  5. 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 ...

  6. 解决: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 ...

  7. sudo 提示 'xxx is not in the sudoers file.This incident will be reported.的解决方法'

    在使用 Linux 的过程中,有时候需要临时获取 root 权限来执行命令时,一般通过在命令前添加 sudo 来解决. 但是第一次使用 sudo 时,有可能会得到这样一个错误提示 xxx is not ...

  8. 企业运维案例: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" 解决 ...

  9. lxs1314 is not in the sudoers file. This incident will be reported.

    虚拟机下面  普通用户用sudo执行命令时报"xxx is not in the sudoers file.This incident will be reported"错误,解决 ...

随机推荐

  1. java web第一个Servlet程序

    Servlet 简介 . Java Servlet是和平台无关的服务器端组件,它运行在Serlet容器中.Servlet容器负责Servlet和客户的通信以及调用Servlet的方法,Servlet和 ...

  2. linux awk命令详解(转)

    http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858470.html 简介 awk是一个强大的文本分析工具,相对于grep的查找,sed的编 ...

  3. ZOJ 2110 Tempter of the Bone(DFS)

    点我看题目 题意 : 一个N×M的迷宫,D是门的位置,门会在第T秒开启,而开启时间小于1秒,问能否在T秒的时候到达门的位置,如果能输出YES,否则NO. 思路 :DFS一下就可以,不过要注意下一终止条 ...

  4. 安装java memcached client到本地maven repository

    由于目前java memcached client没有官方的maven repository可供使用,因此使用时需要手动将其安装到本地repository.java memcached client的 ...

  5. UVA 515 King

    差分约束系统的第一个题目,看了落花大神的博客后,对差分约束有了一定了解,关键在于建图,然后就是判断是否存在负权回路. 关于差分约束系统的解释详见维基百科:http://zh.wikipedia.org ...

  6. DHTMLX 前端框架 建立你的一个应用程序 教程(五)--添加一个表格Grid

    表格例子 样本如下: 我们这篇介绍的是dhtmlxGrid  组件. 它支持4种数据格式:XML, JSON, CSV, JSArray. 添加表格到布局的单元格中去: 1.使用attachGrid( ...

  7. [jobdu]扑克牌顺子

    一开始看到题还以为要DFS还是BFS,后来发现完全不用.排个序,然后看看大小王能不能弥补缺口就行,但后来又发现还要排除有相同大小牌的情况. #include <iostream> #inc ...

  8. RUST叫系统编程语言,而GO是网络编程语言

    用GO你必须要搞清楚一点,GO不是面向CPU密集计算的,而是面向IO密集计算的!!!RUST才是面向CPU密集计算的语言,所以RUST叫系统编程语言,而GO是网络编程语言.GO跟JAVA的Spring ...

  9. 解析rss和atom文件出现乱码问题

    try { String xmlString = new String(response.data, Charset.forName("UTF-8")); XmlPullParse ...

  10. ruby quiz The Solitaire Cipher

    solitaire cipher:http://en.wikipedia.org/wiki/Solitaire_(cipher) https://www.schneier.com/solitaire. ...