ubuntu sudoers 恢复默认权限

平台

Ubuntu Kylin 15.04

问题背景

想给新用户添加sudo权限,没弄好把sudoers文件的权限改成660了『默认440』,之后sudo 就不能用了.
执行 sudo chmod 440 /etc/sudoers 报下面错误:

sudo: /etc/sudoers is world writable
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

解决

最简单的办法是用pkexec。

pkexec chmod 0440 /etc/sudoers

pkexec允许用户以其他用户身份执行程序。如果没有特别指定就用超级用户身份执行。『当然它要求你输入root的密码~』
pkexec allows an authorized user to execute PROGRAM as another user. If username is not specified, then the program will be executed as the administrative super user, root.

还有其他类似windows安全模式的办法解决。

你可能感兴趣的:(Linux)