Ubuntu下is not in the sudoers file 问题解决

时间:2023-03-09 09:05:07
Ubuntu下is not in the sudoers file 问题解决

在Ubuntu12.04 下,使用sudo apt-get install XXX 时,突然跳出 username is not in the sudoers file的问题

然后我一查此username的类型,果然是标准用户而不是管理员用户

解决问题至少有两种方法:

一。System Settings ->User Accounts -> 点击Unlock ->输入rootpassword -> 改动AccountType(用户类型)为Administrator(管理员) -> 重新启动

root用户下,改动/etc/sudoers的权限为640(chmod 640 /etc/sudoers) -> vim /etc/sudoers -> 找到root ALL=(ALL:ALL) ALL ->加入

username ALL=(ALL:ALL) ALL -> 改动/etc/sudoers的权限为440(chmod 440 /etc/sudoers)-> 重新启动

这时我知道的两种方法,若有其它方法,请大神留言告之。