ubuntu 搞坏了sudoers文件之修复方案
pkexec visudo
askubuntu原回答摘抄如下
On a modern Ubuntu system (and many other GNU/Linux distributions), fixing a corrupted sudoers file is actually quite easy, and doesn't require rebooting, using a live CD, or physical access to the machine. To do this via SSH, log in to the machine and run the command pkexec visudo. If you have physical access to the machine, SSH is unnecessary; just open a Terminal window and run that pkexec command. Assuming you (or some other user) are authorized to run programs as root with PolicyKit, you can enter your password, and then it will run visudo as root, and you can fix your /etc/sudoers. If you need to edit one of the configuration files in /etc/sudoers.d (which in uncommon in this situation, but possible), use pkexec visudo -f /etc/sudoers.d/filename. If you have a related situation where you have to perform additional system administration commands as root to fix the problem (also uncommon in this circumstance, but common in others), you can start an interactive root shell with pkexec bash. Generally speaking, any non-graphical command you'd run with sudo can be run with pkexec instead. (If there is more than one user account on the system authorized to run programs as root with PolicyKit, then for any of those actions, you'll be asked to select which one you want to use, before being asked for your password.) If that doesn't work--for example, if there are no users authorized to run programs as root via PolicyKit--then boot from an Ubuntu live CD (like the CD you probably used to install Ubuntu) and mount the filesystem for the installed system. You can do this by running sudo parted -l to view your partitions--there is probably just one ext4 partition, and that's the root filesystem. Suppose the installed Ubuntu system's root filesystem is on /dev/sda1. Then you could mount it with sudo mount /dev/sda1 /mnt. Then you can edit the installed system's sudoers file with sudo nano -w /mnt/etc/sudoers. Or, even better, you can edit it with sudo visudo -f /mnt/etc/sudoers (which will prevent you from saving a sudoers file with incorrect syntax).
ubuntu 搞坏了sudoers文件之修复方案的更多相关文章
- /etc/sudoers文件损坏修复
1. 重启(开机)时按Shift键(这时就会进入grub模式) 选择第二项 进入高级选项
- Ubuntu 误改/etc/sudoers 文件权限
添加用户时不小心修改了/etc/sudoers 权限,结果不能sudo了,Ubuntu默认关闭root帐户,结果傻X了,无法改回了. 方法如下: 1.重启机器,开机按ESC,进入恢复模式 2.此时,磁 ...
- Ubuntu无法sudo提权,报当前用户不在sudoers文件中错误
Ubuntu安装后默认root不能登陆系统,密码也是随机生成,其他用户使用root权限,可以使用sudo提权,前提是该用户在/etc/sudoers配置列表中. 但是有时用户名从/etc/sudoer ...
- Ubuntu改坏sudoers后无法使用sudo的解决办法
练习安装odoo的时候,创建了一个odoo用户,想把它赋予sudo权限,然而,编辑的时候不留意,改坏了,导致sudo无法使用,无法编辑sudoers文件修改回来. 总提示如下信息: >>& ...
- 烂泥:【解决】ubuntu提示ilanni不在sudoers文件中错误
本文由秀依林枫提供友情赞助,首发于烂泥行天下. 今天在Ubuntu系统中新建一个用户ilanni,添加完毕后.在执行有关sudo的命令时,提示如下的错误信息:ilanni 不在 sudoers 文件中 ...
- Ubuntu系统下解决“YourUserName不在sudoers文件中。此事将被报告”的问题
本文由荒原之梦原创,原文链接:http://zhaokaifeng.com/?p=624 问题描述: 之前在使用Fedora系统时遇到过在使用 sudo 时提示"YourUserName不在 ...
- [错误解决]ubuntu 不在 sudoers 文件中。此事将被报告。
跟据报错判断,ubuntu没有sudo权限,经过查询需要将ubuntu账户加入/etc/sudoers中 先切换到root权限 su 输入密码 修改/etc/sudoers配置 vim /etc/su ...
- sudoers文件设置sudo命令无密码(root密码)登录
参考博客:http://xvshell.iteye.com/blog/1838093 1. 当用户执行sudo时,Linux系统会去寻找/etc/sudoers文件,并且这是主动的,判断用户是否有执行 ...
- 用户名 不在 sudoers文件中,此事将被报告。(转)
话说昨天新建了一个帐号linc,今天在执行sudo时回显一个很吓人的信息: [sudo] password for linc: linc 不在 sudoers 文件中.此事将被报告. 这是要去哪儿报告 ...
随机推荐
- AppBox_v2.0完整版免费下载,暨AppBox_v3.0正式发布!
文章更新: AppBox v6.0中实现子页面和父页面的复杂交互 AppBox 是基于 FineUI 的通用权限管理框架,包括用户管理.职称管理.部门管理.角色管理.角色权限管理等模块. AppBox ...
- 如何在ASP.NET Core中使用Redis
注:本文提到的代码示例下载地址> https://code.msdn.microsoft.com/How-to-use-Redis-in-ASPNET-0d826418 Redis是一个开源的内 ...
- Ajax入门(一)
最近开始学习Ajax了0.0,虽然其他的还没巩固,但既然学了就先写下来吧... Ajax的定义呢,百度吧= =...就觉得最实用的地方就是页面无刷新,但网页实现了与后台的同步更新. 1, 首先创建 ...
- Azure 带宽
Azure带宽与Azure Blob云存储 http://www.cnblogs.com/threestone/p/4497625.html
- BZOJ 1876: [SDOI2009]SuperGCD
1876: [SDOI2009]SuperGCD Time Limit: 4 Sec Memory Limit: 64 MBSubmit: 3060 Solved: 1036[Submit][St ...
- SVN 提交报错:×××文件is not under version control
解决方法:1.删除出错的文件,然后在出错文件所在文件夹执行还原操作 2.VS中可将文件先排除在项目外,再包含在项目内,即可正常提交
- ES6入门笔记
ES6入门笔记 02 Let&Const.md 增加了块级作用域. 常量 避免了变量提升 03 变量的解构赋值.md var [a, b, c] = [1, 2, 3]; var [[a,d] ...
- Day8-面向对象进阶&&socket基础
抽象类 python2中的写法 import abc class Alert(object): '''报警基类''' __metaclass__ = abc.ABCMeta @abc.abstract ...
- linux下安装jdk
第一步:查看Linux自带的JDK是否已安装 (卸载centOS已安装的1.4) 安装好的CentOS会自带OpenJdk,用命令 Java -version ,会有下面的信息: Javaversio ...
- zapewnia stale poprawiając relacje związane
W porównaniu do LG5, ta http://www.butyrunning.com/lunarestoa-2-m%C3%84%C2%99skie-c-2_70_71.html kon ...