说的是,这种问题,是出现在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. Docker容器中运行ASP.NET Core

    在Linux和Windows的Docker容器中运行ASP.NET Core 译者序:其实过去这周我都在研究这方面的内容,结果周末有事没有来得及总结为文章,Scott Hanselman就捷足先登了. ...

  2. VSCode调试go

    VSCode调试go语言出现:exec: "gcc": executable file not found in %PATH%   1.问题描述 由于安装VS15 Preview ...

  3. 设置html滚动条(陶庭飞问题)

    var height = document.body.scrollHeight; parent.document.all("rightFrame").style.height = ...

  4. Elasticsearch基础概念理解

    熟悉ES中的几个关键概念: 节点(Node):一个elasticsearch运行的实例,其实就是一个java进程.一般情况下,一台机器运行在一台机器上. 集群(Cluster): 好几个有相同集群名称 ...

  5. 实现strlen,strcpy,strcat,strcmp同功能的函数stringLength,stringCopy,stringCatch,stringCompare

    #import <Foundation/Foundation.h> /* 求字符串长度 */ int stringLength(char arr[]); /* 复制字符串 将arr1 复制 ...

  6. CSS 背景颜色

    颜色背景 CSS中背景颜色由background-color决定,这里的背景颜色会渲染padding和content,不会渲染border和margin部分. 在css3中可以通过background ...

  7. ie6 css sprites重复加载

    如果你使用css sprites,那么在ie6下并不能发挥sprites的作用,它还是会每次再重新 加载这个图片,解决方法为为ie6添加下面这条js: <!--[if IE 6]>     ...

  8. portlet初学习及HelloWorld例子

    1. 在myeclipse中新建一个web project,在src中新建如下类: package com.yoyo.portlet; import java.io.IOException; impo ...

  9. Hadoop集群(第5期副刊)_JDK和SSH无密码配置

    1.Linux配置java环境变量 1.1 原文出处 地址:http://blog.csdn.net/jiedushi/article/details/6672894 1.2 解压安装jdk 在she ...

  10. Struts2的一个问题: 找不到struts.xml的路径问题

    一. 最近在学习Struts2的一些知识,在使用Struts2搭建框架的时候,部署到服务器上的时候出现上面的问题: 三月 19, 2016 1:43:24 下午 org.apache.tomcat.u ...