说的是,这种问题,是出现在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. Cocos2dx坐标转换

    Cocos2dx坐标转换 这段时间加班有点猛,没有太多时间来写博客了,ok,继续完成任务: 前言 这里将会重点介绍四个函数: convertToNodeSpace convertToNodeSpace ...

  2. python mongodb 读写CSV文件

    # -*- coding: utf-8 -*-import osimport csvimport pymongofrom pymongo import MongoClient #建立连接client ...

  3. CSS文档流与块级元素和内联元素(文档)

    CSS文档流与块级元素(block).内联元素(inline),之前翻阅不少书籍,看过不 少文章, 看到所多的是零碎的CSS布局基本知识,比较表面.看过O'Reilly的<CSS权威指 南> ...

  4. PHP漏洞全解(四)-xss跨站脚本攻击

    本文主要介绍针对PHP网站的xss跨站脚本攻击.跨站脚本攻击是通过在网页中加入恶意代码,当访问者浏览网页时恶意代码会被执行或者通过给管理员发信息 的方式诱使管理员浏览,从而获得管理员权限,控制整个网站 ...

  5. sqlite优化记录:建立索引加快查询速度

    凡是数据库中,索引的存在就是为了提高查询速度的,数据库的索引有点类似于书本上面的目录的概念,因为在英文中都是index,事实上也就是目录. 其算法应该叫做“倒排索引”,这个其实也类似于搜索引擎里面的基 ...

  6. php的curl获取https加密协议请求返回json数据进行信息获取

    <?php header("Content-type:text/html; charset=utf-8");function getToken($url){        $ ...

  7. TSS 任务状态段 详解

    http://blog.163.com/di_yang@yeah/blog/static/86118492201222210725146/1 什么是TSS TSS 全称task state segme ...

  8. I2S和PCM

    http://blog.csdn.net/azloong/article/details/6536855

  9. 屏幕尺寸,屏幕分辨率,屏幕密度,各种长宽单位(px,sp,dp,in.pt,mm)

    常见长宽单位表 名称 单位缩写 单位全拼 介绍 屏幕尺寸 '' 或 in inch 屏幕的大小,通常用屏幕对角线的长度表示.单位是寸 屏幕分辨率 px pixels 整个屏幕的像素数,一般用屏幕的像素 ...

  10. WinForm实现简单的拖拽功能(C#)

    用到了ListBox和TreeView两个控件,ListBox作为数据源,通过拖拽其中的数据放置到TreeView上,自动添加一个树节点 ListBox控件的MouseDown用于获取要拖拽的值并调用 ...