因修改/etc/sudoers权限导致sudo和su不能使用的解决方法
2014-04-22 21:37
288 查看
系统环境:ubuntu 12.04
状况:
因为修改了/etc/sudoers以及相关权限,导致sudo无法使用,恰好Ubuntu的root密码没有设置。
错误如下:
于是,只能进去单用户模式(拥有root权力)去修改,在Ubuntu下,开机时长按shift出现各种模式,选择第二个recovery mode,按e进去编辑。
解决方法:
1、重启ubuntu,启动时按Esc或Shift键,可以看到引导选项;
2、在引导选项中选择Recovery模式的那一项来引导;
3、进入Recovery Menu页面,选择root,也就是进入试用root用户进行系统恢复,在这里可以执行超级用户的权限的操作,回车后可以看到熟悉的 root@user ~# 命令提示符;
4、设置或者撤销/etc/sudoers文件的权限,也可以将该文件改回到发生错误之前的状态。
5、退出Recovery模式,重新启动ubuntu。
PS:当然也可以用ubuntu光盘引导系统,然后mount相应的磁盘,然后修改/etc/sudoers文件,进入系统,就可以正常启动了(linux使用熟练的话不妨一试)。
# /etc/sudoers
状况:
因为修改了/etc/sudoers以及相关权限,导致sudo无法使用,恰好Ubuntu的root密码没有设置。
错误如下:
~$ sudo sudo: >>> /etc/sudoers:syntax error 在行 21 附近<<< sudo: /etc/sudoers 中第 21 行附近有解析错误 sudo: 没有找到有效的 sudoers 资源,退出 sudo: 无法初始化策略插件
于是,只能进去单用户模式(拥有root权力)去修改,在Ubuntu下,开机时长按shift出现各种模式,选择第二个recovery mode,按e进去编辑。
解决方法:
1、重启ubuntu,启动时按Esc或Shift键,可以看到引导选项;
2、在引导选项中选择Recovery模式的那一项来引导;
3、进入Recovery Menu页面,选择root,也就是进入试用root用户进行系统恢复,在这里可以执行超级用户的权限的操作,回车后可以看到熟悉的 root@user ~# 命令提示符;
4、设置或者撤销/etc/sudoers文件的权限,也可以将该文件改回到发生错误之前的状态。
chmod 666 /dev/null mount -o remount rw / vi /etc/sudoers 恢复本文件内容并存盘
5、退出Recovery模式,重新启动ubuntu。
PS:当然也可以用ubuntu光盘引导系统,然后mount相应的磁盘,然后修改/etc/sudoers文件,进入系统,就可以正常启动了(linux使用熟练的话不妨一试)。
# /etc/sudoers
# # This file MUST be edited with the 'visudo' command as root. # # See the man page for details on how to write a sudoers file. # Defaults env_reset # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL) ALL # Allow members of group sudo to execute any command after they have # provided their password # (Note that later entries override this, so you might need to move # it further down) %sudo ALL=(ALL) ALL # #includedir /etc/sudoers.d # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL
相关文章推荐
- 因修改/etc/sudoers权限导致sudo和su不能使用的解决方法
- 因修改/etc/sudoers权限导致sudo和su不能使用的解决方法
- 因修改/etc/sudoers权限导致sudo和su不能使用的解决方法
- 因修改/etc/sudoers权限导致sudo和su不能使用的解决方法
- 因修改/etc/sudoers权限导致sudo和su不能使用的解决方法
- linux sudoers修改导致不能在终端使用sudo 和su的解决方法
- Ubuntu /etc/sudoers 权限被误改为777后导致sudo命令不能使用
- ubuntu中修改了sudoers的权限导致,sudoers不能用的解决
- 解决/etc/sudoers权限出错导致sudo不可用的方法
- sudoers修改不能在终端使用sudo 和su的解决方法
- Ubuntu 下误改sudoers权限 导致无法使用sudo解决 (忘记root密码时也可以这...
- 修改了etc下面sudoers权限造成SUDO命令不能用解决方法
- xxx is not in the sudoers file 和 Authority XXX 不能sudo解决方法
- ubuntu中由于将用户权限修改为root导致只能使用guest进入图形化界面的解决方法
- 用户不在sudoers文件中的解决方法,新用户赋予权限的方法
- Chrome浏览器中使用 iframe 嵌入网页导致视频不能全屏的问题解决方法
- 有关td使用colspan属性后导致td不能充满整个tr的问题解决方法
- 普通用户开通sudo权限:xxx is not in the sudoers file.This incident will be reported.的解决方法
- 修改了Ubuntu下的/usr目录权限,导致不能使用sudo命令的修复
- 普通用户开通sudo权限:xxx is not in the sudoers file.This incident will be reported.的解决方法