关于Ubuntu下is not in the sudoers file解决方法
当我在postgres用户下去执行sudo vim demo.sql需要用管理员权限运行时,并且输入本用户的密码,但是输入之后提示如下:
postgers is not in the sudoers file. This incident will be reported
翻译一下:postgres 不在sudoers文件中。将报告此事件。
这时候我们可以根据提示去找到这个 sudoers file 。也就是就是在/etc/sudoers文件里给该用户添加权限。
解决方法如下:
1.切换到root用户下
2./etc/sudoers文件默认是只读的,对root来说也是,因此需先添加sudoers文件的写权限,命令是:
chmod u+w /etc/sudoers
3.然后就可以编辑sudoers文件
vim /etc/sudoers
找到这行 root ALL=(ALL) ALL ,在他下面添加 xxx ALL=(ALL) ALL (这里的xxx是你的用户名).
root ALL=(ALL) ALL
progres ALL=(ALL) ALL
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命令,并且在执行的时候不输入密码.
4.撤销sudoers文件写权限,命令:(通常/etc下文件均是不可写的文件,这时可以:)
chmod u-w /etc/sudoers
然后再去执行:
sudo vim demo.sql,输入密码即可。
over~~~,参考,感谢:https://www.linuxidc.com/Linux/2016-07/133066.htm,~~~
关于Ubuntu下is not in the sudoers file解决方法的更多相关文章
- Linux下is not in the sudoers file解决方法
最近在学习linux,在某个用户(xxx)下使用sudo的时候,提示以下错误:xxx is not in the sudoers file. This incident will be reporte ...
- [转]Linux下is not in the sudoers file解决方法
来源: http://jingyan.baidu.com/article/2a1383284bb3e8074a134f2d.html 当我们使用sudo命令切换用户的时候可能会遇到提示以下错误:xxx ...
- Ubuntu下is not in the sudoers file 问题解决
在Ubuntu12.04 下,使用sudo apt-get install XXX 时,突然跳出 username is not in the sudoers file的问题 然后我一查此userna ...
- ubuntu下Qt cannot find -lGL错误的解决方法 (转载)
在ubuntu下使用Qt 编译时候遇上了cannot find -lGL错误,使用命令 sudo apt-get install libqt4-dev或者sudo apt-get install li ...
- ubuntu下QT输出程序控制台界面难看的解决方法
这几天在ubuntu下装了QT5,但输出程序界面后,简直无法入目 于是,随便乱找后,终于找到解决方法 打开选项 在终端那行改下就行
- win使用telnet到ubuntu下vim显示中文为乱码的解决方法~
1.几个路径: ubuntu: /etc/default/locale 相当于 centos:/etc/sysconfig/i18n vimrc的路径:① ~/.vimrc ② /etc/vi ...
- is not in the sudoers file解决方法
用sudo时提示"xxx is not in the sudoers file. This incident will be reported.其中XXX是你的用户名,也就是你的用户名没有权 ...
- Linux中“is not in the sudoers file”解决方法
当在终端执行sudo命令时,系统提示"hadoop is not in the sudoers file": 其实就是没有权限进行sudo,解决方法如下(这里假设用户名是cuser ...
- [RedHat]“is not in the sudoers file”解决方法
当在终端执行sudo命令时,系统提示“luckchengis not in the sudoers file”: $ sudo ls Password: luckcheng is not in the ...
随机推荐
- c# HttpClient的HTTP/2支持
HTTP/2 是 HTTP 协议的主要修订版.HTTP/2 的一些显著功能是支持标头压缩和通过同一连接完全多路复用流.虽然 HTTP/2 保留了 HTTP 的语义(HTTP 标头.方法等),但它在数据 ...
- matplotlib 柱状图
222 # coding utf-8 # import matplotlib import numpy as np import matplotlib.pyplot as plt import mat ...
- Apollo配置中心--安装使用-docker
官网:https://github.com/ctripcorp/apollo Apollo(阿波罗)是携程框架部门研发的分布式配置中心,能够集中化管理应用不同环境.不同集群的配置,配置修改后能够实时推 ...
- Maven 教程(14)— Maven聚合与继承
原文地址:https://blog.csdn.net/liupeifeng3514/article/details/79553011 1.Maven聚合 我们在平时的开发中,项目往往会被划分为好几个模 ...
- idea导入工程
idea导入svn中的工程,一般是多模块的工程. 1 在idea中导入一个工程的目录,可以建立对应的文件夹 dy-task ,svn选择对应的分支导入 2 在dy-task同目录下建立其他目录 dy- ...
- Linux内核文档翻译——sysfs.txt
sysfs - _The_ filesystem for exporting kernel objects. sysfs – 用于导出内核对象(kobject)的文件系统 Patrick Mochel ...
- 前端与算法 leetcode 125. 验证回文串
目录 # 前端与算法 leetcode 125. 验证回文串 题目描述 概要 提示 解析 解法一:api侠 解法二:双指针 算法 传入测试用例的运行结果 执行结果 GitHub仓库 查看更多 # 前端 ...
- Windows设置国内源阿里云镜像加速与离线安装pip包的方法
Windows设置国内源阿里云镜像加速1.先在 windows “文件资源管理器” 地址栏 输入 %APPDATA% 按回车,打开程序自定义设置文件夹然后,创建名为 pip 的文件夹,用于存放 pip ...
- Remote Desktop突然不能用了 “This could be due to CredSSP encryption oracle remediation”
一段时间没有用RDP去连远程的Windows主机,某一天突然发现用不了了. 错误信息如下: An authentication error has occurred. The function req ...
- ZYNQ笔记(5):软中断实现核间通信
ZYNQ包括一个 FPGA 和两个 ARM,多个 ARM 核心相对独立的运行不同的任务,每个核心可能运行不同的操作系统或裸机程序,但是有一个主要核心,用来控制整个系统以及其他从核心的允许.因此我们可以 ...