关于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 ...
随机推荐
- [Python] Python 获取中文的首字母 和 全部拼音首字母
Python 获取中文的首字母 和 全部拼音首字母 代码如下: import pinyin def getStrAllAplha(str): return pinyin.get_initial(str ...
- 用JQuery内置animate方法实现数字递增动画
平时使用animate只用于dom节点的动画,无意间发现JQuery内置的animate方法可实现数字动画,JQ还是挺强大的! 动画效果为从0一步步跳到84,代码如下: $({ // 起始值 coun ...
- vue package-lock.json
npm5之后安装文件之后会多出一个package-lock.json的文件,它的作用是: 1. 安装之后锁定包的版本,手动更改package.json文件安装将不会更新包,想要更新只能使用 npm i ...
- 图解 Java 垃圾回收机制,写得非常好!
阅读本文大概需要 3.7 分钟. 翻译:Rhys_Lee, AzureSora, 溪边九节, 小小菜鸟鸡 blog.csdn.net/zl1zl2zl3/article/details/9090408 ...
- Gamma阶段第七次scrum meeting
每日任务内容 队员 昨日完成任务 明日要完成的任务 张圆宁 #91 用户体验与优化https://github.com/rRetr0Git/rateMyCourse/issues/91(持续完成) # ...
- 导出OpenID为txt文件的方法
导出OpenID为txt文件的方法 public function export(){ $shop = M("Shop"); $arr = $shop->field('ope ...
- linux下ELK搭建好之后配置sentinl插件,进行邮件告警
ELK的环境搭建好之后,如何利用收集到的数据进行数据告警呢?在破解ELK之后,它本身提供一个监视器功能,配置偏向编写脚本.有一个更加方便的插件sentiel. 一.下载并安装sentinl插件 htt ...
- Debug 路漫漫-09:构建CNN时维度不一致问题
Build CNN Network 之后,运行,但是报错: ValueError: Input 0 is incompatible with layer predict_vector_conv1: e ...
- python 关于celery的定时任务队列的基本使用(celery+redis)【采用配置文件设置】
工程结构沿用https://www.cnblogs.com/apple2016/p/11422388.html,只需修改celeryconfig.py文件即可: 1.更新celeyconfig.py文 ...
- Laravel jwt 多表验证隔离
为什么要做隔离 当同一个laravel项目有多端(移动端.管理端......)都需要使用jwt做用户验证时,如果用户表有多个(一般都会有),就需要做token隔离,不然会发生移动端的token也能请求 ...