歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 使用sudo時user is not in sudoers file 的解決

使用sudo時user is not in sudoers file 的解決

日期:2017/2/28 14:44:03   编辑:Linux教程

在Linux操作系統中,以普通用戶使用sudo時,常常會出現這個報錯,如:
[Oracle@DBA2 fd]$ sudo ps -ef|grep dbw
[sudo] password for oracle:
oracle is not in the sudoers file. This incident will be reported.
[oracle@DBA2 fd]$
報錯給出原因是用戶oracle不在sudo的配置文件中,oracle用戶無權限使用sudo;

解決辦法:
以root用戶修改/ete/sudoer 文件屬性為root可修改,並在root ALL 行下添加 oracle ALL(類似root行)
[root@DBA2 etc]# chmod u+w sudoers
[root@DBA2 etc]# vi sudoers
添加 oracle ALL=(ALL) ALL

將sudoer屬性改回原值:
[root@DBA2 etc]# chmod u-w sudoers
[root@DBA2 etc]# ll sudoers
-r--r----- 1 root root 3402 Sep 4 10:40 sudoers

再試試sudo的命令,可以使用了;
[oracle@DBA2 ~]$ sudo ps -ef|grep dbw
[sudo] password for oracle:
oracle 3140 1 0 09:28 ? 00:00:06 ora_dbw0_orcl2
oracle 19299 17065 0 10:41 pts/2 00:00:00 grep dbw

Copyright © Linux教程網 All Rights Reserved