当前位置: 首页 > article >正文

Linux:xxx is not in the sudoers file. This incident will be reported.

报错

xxx is not in the sudoers file.  This incident will be reported.

解决方式

切换到root用户下操作

# 1、修改/etc/sudoers文件为可修改,默认是只读的
ls -lh /etc/sudoers
-r--r----- 1 root root 4.3K Dec  1 01:45 /etc/sudoers

chmod u+w /etc/sudoers

ls -lh /etc/sudoers
-rw-r----- 1 root root 4.3K Dec  1 01:45 /etc/sudoers


# 2、添加用户配置
vi /etc/sudoers

root ALL=(ALL) ALL
username ALL=(ALL) NOPASSWD: ALL

# 3、恢复文件为只读状态
chmod u-w /etc/sudoers

ls -lh /etc/sudoers
-r--r----- 1 root root 4.3K Mar 22 15:24 /etc/sudoers

支持设置的格式

youuser ALL=(ALL) ALL
%youuser ALL=(ALL) ALL
youuser ALL=(ALL) NOPASSWD: ALL
%youuser ALL=(ALL) NOPASSWD: ALL

说明:

  • 第一行:允许用户youuser执行sudo命令(需要输入密码).
  • 第二行:允许用户组youuser里面的用户执行sudo命令(需要输入密码).
  • 第三行:允许用户youuser执行sudo命令,并且在执行的时候不输入密码.
  • 第四行:允许用户组youuser里面的用户执行sudo命令,并且在执行的时候不输入密码.

参考文章

解决linux下sudo更改文件权限报错xxxis not in the sudoers file. This incident will be reported.
https://blog.csdn.net/sinat_36118270/article/details/62899093


http://www.kler.cn/a/596985.html

相关文章:

  • PyTorch中BatchNorm2D的实现与BatchNorm1D的区别解析
  • HCL—我与虚拟机的爱恨情仇[特殊字符][特殊字符]‍[特殊字符]️
  • 32.[前端开发-JavaScript基础]Day09-元素操作-window滚动-事件处理-事件委托
  • 【gradio】全面解析 Gradio 的 Blocks 框架:构建灵活的 Python 前端界面
  • Spring的IOC
  • dv-scroll-board 鼠标移入单元格显示单元格所有数据
  • systemd-networkd 的 /etc/systemd/network/*.network 的配置属性名称是不是严格区分大小写?是
  • 全面解读 联核科技四向穿梭车的常见功能介绍
  • 记录一次truncate导致MySQL夯住的故障
  • 【003安卓开发方案调研】之ReactNative技术开发安卓
  • 金蝶云星辰数据集成技术案例:采购退货对接旺店通
  • SpringBoot项目实战(初级)
  • 在Android Studio中,如何快速为变量添加m?
  • 2025年3月22日(自动控制原理)
  • 【赵渝强老师】在Docker中运行达梦数据库
  • 基于C8051F020单片机的液晶显示,LCD1602并口驱动,单片机并口驱动LCD1602
  • Vue.js 表单开发
  • python3最新版下载及python 3.13.1安装教程(附安装包)
  • MySQL拒绝访问
  • SAP ABAP SELECT SINGLE 注意点