linux用户没有执行操作的权限

[oracle@localhost ~]$ sudo yum -y install unzip

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for oracle: 

oracle is not in the sudoers file.  This incident will be reported.
配置sudoers实现oracle用户以root身份执行命令:

第一步:在root用户下编辑sudoers配置文件。将与wheel组相关的配置信息前的注释符号“#”去掉。使所有属于wheel组的用户具有root用户的所有命令执行的权限。

[root@localhost ~]# visudo
-------------修改前---------------
#%wheel ALL=(ALL)       ALL
# Same thing without a password
#%wheel ALL=(ALL)       NOPASSWD: ALL
-----------修改后-----------------
%wheel ALL=(ALL)       ALL
# Same thing without a password
%wheel ALL=(ALL)       NOPASSWD: ALL

第二步:将oracle用户添加到wheel组中,在group文件中找到“wheel”关键字所在行记录。
在wheel记录后面添加“,oracle”,实现将oracle用户加入到wheel组中

[root@localhost ~]# vi /etc/group
wheel:x:10:root,oracle

第三步:测试
我们可以使用“id”命令简单测试一下sudo命令的可用性。
oracle用户下使用id命令获得当前用户的信息

[oracle@secdb1 ~]$ id
uid=500(oracle) gid=501(oinstall) groups=10(wheel),500(dba),501(oinstall)

关于sudo的深入配置方法,可以使用man sudo自行查询

发布了10 篇原创文章 · 获赞 0 · 访问量 959

猜你喜欢

转载自blog.csdn.net/weixin_43572702/article/details/104968452