关于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 ...
随机推荐
- 网络协议 12 - HTTP 协议
日常开发中,我们经常会碰到查询网络是否畅通以及域名对应 IP 地址等小需求,这时候用的最多的应该就是 ping 命令了. 那你知道 ping 命令是怎么工作的吗?今天,我们就来一起认识下 ping 命 ...
- sql server 2016 AlwaysOn实现无域高可用全教程
一.简介环境:小编使用的服务器是windows server 2016(系统服务器) + sql server 2016(数据库服务器)(windows server 2016 + sql serve ...
- Computer-Hunters——项目系统设计与数据库设计
Computer-Hunters--项目系统设计与数据库设计 前言 本次作业属于2019秋福大软件工程实践Z班 本次作业要求 团队名称: Computer-Hunters 本次作业目标:撰写一份针对团 ...
- java calendar获取系统当前小时数
calendar获取系统当前小时数 24小时制 Calendar calendar = Calendar.getInstance(); int curHour24 = calendar.get(c ...
- gamma测试报告
Gamma阶段测试报告 测试计划及结果 我们针对测试做了比较多的改进. 测试代码分为针对纯java部分的单元测试和需要android运行环境的自动化仪器化测试 单元测试 这一部分基本继承Beta阶段的 ...
- 使用rxjs以及javascript解决前端的防抖和节流
JavaScript实现方式: 防抖 触发高频事件后 n 秒内函数只会执行一次,如果 n 秒内高频事件再次被触发,则重新计算时间:思路:每次触发事件时都取消之前的延时调用方法: 举个例子:做一个自动查 ...
- SuperMemo
SuperMemo Your friend, Jackson is invited to a TV show called SuperMemo in which the participant is ...
- [转帖]IBM Q3财报:云营收达到50亿美元 上升11%
IBM Q3财报:云营收达到50亿美元 上升11% http://www.eetop.cn/cpu_soc/6946136.html 2019年Q3 IBM的营收 从千亿到 缩减到了 八百亿刀 卖掉了 ...
- [转帖]Linux firewalld 防火墙使用
Linux firewalld 防火墙使用 2018-06-19 19:26:08 蚩尤后裔 阅读数 2101 收藏 更多 分类专栏: Linux 版权声明:本文为博主原创文章,遵循CC 4.0 ...
- Linux中常用命令cat
cat可谓是随处可用,全名:concatenate and print files.用于连接和打印文件,按序读取文件内容,然后输出到标准输出.如果文件是单个破折号-或者缺乏文件,cat将读取标准输入. ...