sudo报错:no valid sudoers sources found, quitting

简介: sudo报错:no valid sudoers sources found, quitting

在使用Linux系统过程中,通常情况下,我们都会使用普通用户进行日常操作,而root用户只有在权限分配及系统设置时才会使用,而root用户的密码也不可能公开。普通用户执行到系统程序时,需要临时提升权限,sudo就是我们常用的命令,仅需要输入当前用户密码,便可以完成权限的临时提升。在使用sudo命令的过程中,我们经常会遇到当前用户不在sudoers文件中的提示信息,如果解决该问题呢?通过下面几个步骤,可以很简单的解决此问题。


1、切换到root用户权限

[oldlu@bigdata~]$ su root
[root@bigdatauser]#

2、查看/etc/sudoers文件权限,如果只读权限,修改为可写权限

[root@Compile user]# ls -l /etc/sudoers
-r--r-----. 1 root root 4030 9月 25 00:57 /etc/sudoers
[root@Compile user]# chmod 777 /etc/sudoers
[root@Compile user]# ls -l /etc/sudoers
-rwxrwxrwx. 1 root root 4030 9月 25 00:57 /etc/sudoers
[root@Compile user]#

3、执行vi命令,编辑/etc/sudoers文件,添加要提升权限的用户;在文件中找到root ALL=(ALL) ALL,在该行下添加提升权限的用户信息,如:


root ALL=(ALL) ALL

user ALL=(ALL) ALL


说明:格式为(用户名 (tab或空格,原文中为tab或者直接抄下来)网络中的主机=(执行命令的目标用户) 执行的命令范围)


4、保存退出,并恢复/etc/sudoers的访问权限为440,不恢复依旧报错

[root@Compile user]# chmod 440 /etc/sudoers
[root@Compile user]# ls -l /etc/sudoers
-r--r-----. 1 root root 4030 9月 25 00:57 /etc/sudoers
[root@Compile user]#
目录
相关文章
|
监控 调度 开发工具
IO神器blktrace使用介绍
## 前言 1. blktrace的作者正是block io的maintainer,开发此工具,可以更好的追踪IO的过程。 2. blktrace 结合btt可以统计一个IO是在调度队列停留的时间长,还是在硬件上消耗的时间长,利用这个工具可以协助分析和优化问题。 ## blktrace的原理 一个I/O请求的处理过程,可以梳理为这样一张简单的图: ![](http://image
20295 0
|
应用服务中间件 nginx
【报错】Failed to start A high performance web server and a reverse proxy server.
【报错】Failed to start A high performance web server and a reverse proxy server.
996 2
|
Ubuntu Unix Linux
Linux 用户使用sudo时 显示xxx is not in the sudoers file.This incident will be reported.的解决方法
Linux 用户使用sudo时 显示xxx is not in the sudoers file.This incident will be reported.的解决方法
4143 1
|
Java
线程池内部机制:线程的保活与回收策略
【10月更文挑战第24天】 线程池是现代并发编程中管理线程资源的一种高效机制。它不仅能够复用线程,减少创建和销毁线程的开销,还能有效控制并发线程的数量,提高系统资源的利用率。本文将深入探讨线程池中线程的保活和回收机制,帮助你更好地理解和使用线程池。
547 2
在Linux中,ps aux 中的 VSZ 代表什么意思?RSS 代表什么意思?
在Linux中,ps aux 中的 VSZ 代表什么意思?RSS 代表什么意思?
ConnectionResetError: [Errno 104] Connection reset by peer|4-16
ConnectionResetError: [Errno 104] Connection reset by peer|4-16
|
iOS开发 MacOS
解决CocoaPods安装卡住反应慢或失败
解决CocoaPods安装卡住反应慢或失败
2954 4
|
数据处理 Python
【Python】解决tqdm ‘module‘ object is not callable
在使用tqdm库时遇到的“'module' object is not callable”错误,并给出了正确的导入方式以及一些使用tqdm的常见示例。
590 1
|
网络协议 数据安全/隐私保护 网络架构
|
API 计算机视觉 Docker
ModelScope问题之安装mmcv报错如何解决
本合集将提供ModelScope安装步骤、配置要求和环境准备,以便用户顺利启动ModelScope进行模型开发和测试。
783 2

热门文章

最新文章