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

來源:互聯網
上載者:User

在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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.