Linux中“is not in the sudoers file”解决方法

简介:

最近虚拟机装了个RedHat Enterprise Server 5,用惯了Ubuntu,觉得不太适应。

 

当在终端执行sudo命令时,系统提示“cuser is not in the sudoers file”:

$ sudo ls
Password:
cuser is not in the sudoers file.  This incident will be reported.

 

其实就是没有权限进行sudo,解决方法如下(这里假设用户名是cuser):

1.切换到超级用户:$ su

2.打开/etc/sudoers文件:$vi /etc/sudoers

3.修改文件内容:

找到“root    ALL=(ALL)       ALL”一行,在下面插入新的一行,内容是“cuser   ALL=(ALL)       ALL”,然后在vi键入命令“wq!”保存并退出。

注:这个文件是只读的,不加“!”保存会失败。

4.退出超级用户:$ exit

5.可以尽情使用sudo了。

目录
相关文章
|
7月前
|
Linux
Linux下使用ls查看文件颜色全部为白色的解决方法,以及Linux中文件颜色介绍
Linux下使用ls查看文件颜色全部为白色的解决方法,以及Linux中文件颜色介绍
257 2
|
9月前
|
Linux 开发工具
Linux yum 使用时提示 获取 GPG 密钥失败Couldn‘t open file RPM-GPG-KEY-EPEL-7
Linux yum 使用时提示 获取 GPG 密钥失败Couldn‘t open file RPM-GPG-KEY-EPEL-7
460 3
|
5月前
|
Linux 开发工具 数据安全/隐私保护
linux异常一:feng 不在 sudoers 文件中,此事将被报告。yum提示Another app is currently holding the yum lock; waiting for
这篇文章介绍了在CentOS 7系统中安装Docker时遇到的两个常见问题及其解决方法:用户不在sudoers文件中导致权限不足,以及yum被锁定的问题。
74 2
linux异常一:feng 不在 sudoers 文件中,此事将被报告。yum提示Another app is currently holding the yum lock; waiting for
|
5月前
|
安全 Linux 数据安全/隐私保护
Linux 忘记密码解决方法
Linux 忘记密码解决方法
88 2
Linux 忘记密码解决方法
|
6月前
|
Oracle Java 关系型数据库
Linux下JDK环境的配置及 bash: /usr/local/java/bin/java: cannot execute binary file: exec format error问题的解决
如果遇到"exec format error"问题,文章建议先检查Linux操作系统是32位还是64位,并确保安装了与系统匹配的JDK版本。如果系统是64位的,但出现了错误,可能是因为下载了错误的JDK版本。文章提供了一个链接,指向Oracle官网上的JDK 17 Linux版本下载页面,并附有截图说明。
Linux下JDK环境的配置及 bash: /usr/local/java/bin/java: cannot execute binary file: exec format error问题的解决
|
6月前
|
Docker 容器
14 response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file speci
14 response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file speci
104 1
|
7月前
|
应用服务中间件 Linux 网络安全
【Azure 应用服务】PHP应用部署在App Service for Linux环境中,上传文件大于1MB时,遇见了413 Request Entity Too Large 错误的解决方法
【Azure 应用服务】PHP应用部署在App Service for Linux环境中,上传文件大于1MB时,遇见了413 Request Entity Too Large 错误的解决方法
|
7月前
|
存储 Linux Shell
【应用服务 App Service】App Service For Linux 中如何挂载一个共享文件夹呢? Mount Azure Storage Account File Share
【应用服务 App Service】App Service For Linux 中如何挂载一个共享文件夹呢? Mount Azure Storage Account File Share
|
7月前
|
Linux
【Linux系统】使用g = GloveEmbedding()报错BadZipFile: File is not a zip file
本文讨论了在使用embeddings工具包时遇到的“BadZipFile: File is not a zip file”错误,原因是程序中断导致zip文件损坏,解决方法是删除损坏的文件并重新运行程序,具体操作是在Linux系统中删除“~/.embeddings/”目录下的glove文件夹。
57 0
|
21天前
|
Linux
Linux系统之whereis命令的基本使用
Linux系统之whereis命令的基本使用
56 23
Linux系统之whereis命令的基本使用