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

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

相关文章:

  • macOS Sequoia 15.3 一直弹出“xx正在访问你的屏幕”
  • 深度学习篇---对角矩阵矩阵的秩奇异矩阵
  • 异地灾备介绍
  • STM32中断
  • 【Android】基于udp通信的智能家居移动应用开发
  • 强化学习中循环神经网络在序列决策中的应用研究
  • 每日一题-力扣-2680. 最大或值-20250321
  • 机器学习--DBSCAN聚类算法详解
  • [学习笔记] 部署Docker搭建靶场
  • 机器学习实战
  • 比特币驱动金融第七章——比特币:社区、政治与监管的微妙平衡
  • stratis,容器podman
  • 基于3DMax与Vray引擎的轻量级室内场景渲染实践
  • 校园自习室预约小程序(源码+部署教程)
  • 企业磁盘管理实战:常见问题与高效解决方案
  • Spring6: 2 入门
  • Node.js系列(4)--微服务架构实践
  • next.js 组件路由钩子
  • Linux上位机开发实战(能用的开发板计算资源)
  • 3.9 Spring Boot国际化:动态语言切换与数据库存储方案
  • 珠海做网站价格/定制网站开发公司
  • 电脑网站在哪里找/在线crm网站建站
  • 做网站反复修改/seo品牌
  • 萍乡建站公司/市场推广方案和思路
  • 动态网站开发的语言/台州百度快照优化公司
  • 福建漳州网站建设公司/网络营销推广系统