备忘录(006) - 非root用户不能使用sudo


如何解决非root用户使用sudo时报错xxx is not in the sudoers file

切换root用户

修改/etc/sudoers文件的权限
chmod 777 /etc/sudoers

在第100行
root ALL=(ALL) ALL

插入一行,追加用户xxxx
xxxx ALL=(ALL) ALL

保存后,还原文件权限(只读)
chmod 440 /etc/sudoers

退出root用户
exit