在进行相关文件操作时没有权限,使用sudo 后提示:xxx is not in the sudoers file,This incident will be reported.
解决办法:
切换超用户:su root
输入超级用户密码
修改用户配置文件、/etc/sudoers的权限:chmod u+w /etc/sudoers
使用vi 编辑/etc/sudoers 配置文件,在root ALL=(ALL) ALL 的下一行按同样样式写上自己账号名,然后保存退出
# Allow root to run any commands anywhere
root ALL=(ALL) ALL
修改回文件权限:chmod u-w /etc/sudoers
切换到普通用户,就可以使用sudo 命令了。