zoukankan      html  css  js  c++  java
  • oracle is not in the sudoers file. This incident will be reported.

    准备把OS的root禁用了,所以其他用户要执行使用root执行的操作时,需要使用sudo。

    在没有配置sudo的时候,执行sudo会出现类似以下的报错:

    [oracle@test ~]$ sudo /u01/app/oracle/product/11。1/db_1/root。sh
    Password:
    oracle is not in the sudoers file。 This incident will be reported。

    解决办法:

    1.切换到root用户下

    2.添加sudo文件的写权限:
    chmod u+w /etc/sudoers

    3.编辑sudoers文件
    vi /etc/sudoers
    找到这行 root ALL=(ALL) ALL,在下面添加xxx ALL=(ALL) ALL (这里的xxx是需要添加进去的用户名)

    ps: sudoers添加下面四行中任意一条
    youuser            ALL=(ALL)                ALL
    %youuser           ALL=(ALL)                ALL
    youuser            ALL=(ALL)                NOPASSWD: ALL
    %youuser           ALL=(ALL)                NOPASSWD: ALL

    第一行:允许用户youuser执行sudo命令(需要输入密码)。
    第二行:允许用户组youuser里面的用户执行sudo命令(需要输入密码)。
    第三行:允许用户youuser执行sudo命令,并且在执行的时候不输入密码。
    第四行:允许用户组youuser里面的用户执行sudo命令,并且在执行的时候不输入密码。

    4.撤销sudoers文件写权限:
    chmod u-w /etc/sudoers

    如果不撤销会报错:

    [oracle@test ~]$ sudo /u01/app/oracle/product/11.1/db_1/root.sh
    sudo: /etc/sudoers is mode 0640, should be 0440


    这样非root用户就可以使用sudo了

  • 相关阅读:
    HubbleDotNet 开源全文搜索数据库项目指定单词权重
    AcWing 12. 背包问题求具体方案
    Acwing 1058 股票买卖V
    AcWing 487 金明的预算方案
    AcWing 426. 开心的金明
    AcWing 1052. 设计密码
    AcWing 11. 背包问题求方案数
    AcWing 10. 有依赖的背包问题
    AcWing 1057. 股票买卖 IV
    AcWing 734 能量石
  • 原文地址:https://www.cnblogs.com/nazeebodan/p/5191919.html
Copyright © 2011-2022 走看看