你有没有遇到过改用户权限结果主用户也获取不了root权限的情况?

ubuntu系统,新建一个用户,该用户默认是没有root权限的,安装软件之类的操作很不方便,想更新一下该用户的权限。
编辑/etc/sudoers添加一句jz ALL=(ALL:ALL) ALL(新建用户的用户名是jz)
结果保存后出现

nvidia@tegra-ubuntu:~$ sudo su
/etc/sudoers: syntax error near line 1
sudo: parse error in /etc/sudoers near line 1
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

凉了,主用户也用不了root权限了。
各种需要高权限的操作都没有办法进行了。怎么破?

上面的提示信息已经讲得很清楚了。在/etc/sudoers中第一行有语法错误。也就是说,改文件的时候改错了。

解决办法是
在图形界面的终端内输入命令

pkexec visudo -f /etc/sudoers

把刚刚改错的地方,也就是出现语法错误的地方,改回来。保存退出,(o゜▽゜)o☆[BINGO!]

参考:https://arstechnica.com/civis/viewtopic.php?t=1246553

注意:
一定要在图形界面的终端内操作,用ssh连接后执行相同的命令也会提示没有权限。

nvidia@tegra-ubuntu:~$ pkexec visudo
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/usr/sbin/visudo’ as the super user
Multiple identities can be used for authentication:
1. ,,, (ubuntu)
2. ,,, (nvidia)
Choose identity to authenticate as (1-2): 1
Password:
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
==== AUTHENTICATION FAILED ===
Error executing command as another user: Not authorized
This incident has been reported.

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值