在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
推薦閱讀:
Ubuntu的sudo與su命令使用與開啟root帳戶
sudo: sorry, you must have a tty to run sudo
Linux配置sudo許可權
sudo配置臨時取得root許可權
Linux下解決使用者不能執行sudo的方法
Linux系統管理員不可不知的命令:sudo