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 文件中.此事将被报告. 这是要去哪儿报告 ...
随机推荐
- JavaScript 属性类型(数据属性和访问器属性)
数据属性 数据属性包含一个数据值的位置.在这个位置可以读取和写入值.数据属性有 4 个描述其行为的特性. [[Configurable]]:表示能否通过 delete 删除属性从而重新定义属性,能否修 ...
- RedisUtil 工具类
package com.test; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import red ...
- Freemarker中空值 null的处理++++定义数组
http://blog.java-zone.org/archives/800.html <#list listBlogPost as blogPost> </#list> 如果 ...
- pip安装使用详解(转)
pip类似RedHat里面的yum,安装Python包非常方便.本节详细介绍pip的安装.以及使用方法. 1.pip下载安装 1.1 pip下载 1 # wget "https://py ...
- js小练习去掉指定的字符组成一句话输出
今天在codewar做练习题时,要求写一个函数把一个字符串去掉WUB这些多余的字符然后把剩下的组成一句话输出,如传入"WUBAWUBBWUBCWUB"后返回"A B C& ...
- 【BZOJ-3627】路径规划 分层图 + Dijkstra + spfa
3627: [JLOI2014]路径规划 Time Limit: 30 Sec Memory Limit: 128 MBSubmit: 186 Solved: 70[Submit][Status] ...
- C# 扩展系统类方法
1.声明扩展方法的步骤:类必须是static,方法是static 2.第一个参数是被扩展的对象,前面标注this 3.使用扩展方法的时候必须保证扩展方法类已经在当前代码中using 例子:using ...
- Mac OSX:Powerline风格的zsh配置
需要的工具 iTerm,一个替代OSX自带终端的软件,基于iTerm才能实现上面的效果: oh-my-zsh,zsh是OSX上最强大的shell,没有之一,但是配置过程较为复杂,这个脚本能够帮你一键配 ...
- mysql5.7安装配置
sonar要求mysql5.6版本,所以安装一下最新的mysql5.7 相对路径配置一直存在问题,所以采用绝对路径配置,本次配置的基础路径是: D:\sonar\mysql-5.7.17-winx64 ...
- DOG检测
共享一个代码算了,太忙鸟,有时间在补充. function [] = dog_learn() img = imread('/Users/img/lena.png'); img = rgb2gray(i ...