1.不适当操作,改了sudoers的权限
scdev@scdev1005:~$ sudo vim /etc/profile
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
解决:
scdev@scdev1005:~$ su
Password:
root@scdev1005:/home/scdev#
root@scdev1005:~# chown root:users /etc/sudoers
虚拟机下的类似不当操作造成
sudo: /etc/sudoers is mode 0600, should be 0440
解决:
重启(shutdown -r now),按住shift进入recovery mode
进去的时候默认mout到read-only的FS,需要重新mount到read-write的FS才能改权限。
输入
mount -o remount, rw /
重启即可!
有人遇到如下问题,我是没遇到,可能跟版本有关
vmware boot得太快根本来不及按SHIFT进recovery mode呀!开机关机NN遍之后我决定再google一下看看有什么解决方案。看到有人说可以用vmware的 vm->power into BIOS来放慢boot的速度。照做之,终于能进入recovery mode了。
2.root密码修改
scdev@scdev1005:~$ sudo passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully