Linux系统下xxx is not in the sudoers file解决方法

文章目录

遇到问题

服务器上新建用户,名为lishizheng,现在想给该用户添加sudo权限。

cpp 复制代码
$ sudo lsof -i tcp:7890
[sudo] password for lishizheng: 
lishizheng is not in the sudoers file.  This incident will be reported.

解决方法

登录root用户,编辑/etc/sudoers文件

cpp 复制代码
$ sudo su # 进入root账户
$ vim /etc/sudoers # 使用vim编辑sudoers文件

在User privilege specification 下面添加username

cpp 复制代码
#User privilege specification

root     ALL=(ALL:ALL) ALL

username ALL=(ALL:ALL) ALL

如下图,这里的用户名是lishizheng

使用:wq退出的时候会显示

cpp 复制代码
E45: 'readonly' option is set (add ! to override)

这时候只要使用:wq!,后面添加一个感叹号即可安全退出。

经过上述操作,新用户lishizheng就拥有了sudo权限。

参考

1\] https://stackoverflow.com/questions/47806576/linux-username-is-not-in-the-sudoers-file-this-incident-will-be-reported

相关推荐
阿伟实验室9 分钟前
debian10部署简易web服务器
运维·服务器·前端
Linux技术芯23 分钟前
金刚经修心课 你的生活指南
linux
北京阿法龙科技有限公司26 分钟前
AR眼镜赋能跨国设备运维:打破空间隔阂,重构高效协作|阿法龙XR云平台
运维·重构·ar
Kathleen1001 小时前
计算机网络——应用层
运维·服务器·计算机网络
java_logo1 小时前
BUSYBOX Docker 容器化部署指南
java·运维·python·nginx·docker·容器·运维开发
Mr.H01272 小时前
多线程文件拷贝:从原理到实现的完整指南
linux·运维
橘子真甜~2 小时前
C/C++ Linux网络编程5 - 网络IO模型与select解决客户端并发连接问题
linux·运维·服务器·c语言·开发语言·网络·c++
霖002 小时前
ZYNQ——ultra scale+ IP 核详解与配置
服务器·开发语言·网络·笔记·网络协议·tcp/ip
e***74952 小时前
Nginx 常用安全头
运维·nginx·安全
oushaojun22 小时前
Linux内核KGDB进阶:源码级调试实战演练(转)
linux·运维·kgdb