用户属性不在主厨配方的bash资源中工作

时间:2021-06-17 00:24:56

I am trying to run one command as grid user.

我试图以网格用户身份运行一个命令。

Code-1 is not working. Giving permission not available error.

Code-1不起作用。给予权限不可用错误。

code-2 is working. What is the issue?

code-2正在运行。有什么问题?

Code-1

bash "start ora.cssd" do        code <<-EOH        /u01/app/grid/11.2.0.4/bin/crsctl start resource ora.cssd -init    EOH    user "grid"end

code-2

bash "start ora.cssd" do    code <<-EOH         sudo su - grid -c "/u01/app/grid/11.2.0.4/bin/crsctl start resource ora.cssd -init"    EOHend

I am not able to understand why bash is not able to run that command as grid user in code-1 snippet

我无法理解为什么bash无法在code-1片段中以网格用户身份运行该命令

Exact error log for code-1 snippet:

code-1片段的确切错误日志:

Recipe: Oracle11G::startGridservices  * execute[start ora.cssd] action run[2015-04-21T14:31:43+00:00] INFO: Processing execute[start ora.cssd] action run (Oracle11G::startGridservices line 4)================================================================================Error executing action `run` on resource 'execute[start ora.cssd]'================================================================================Errno::EACCES-------------Permission denied - /u01/app/grid/11.2.0.4/bin/crsctl start resource ora.cssd -init

========================

i ran the above command with root user and i am not getting permission denied issue.

我用root用户运行上面的命令,我没有得到权限被拒绝的问题。

su -c "/u01/app/grid/11.2.0.4/bin/crsctl start resource ora.cssd -init" grid

su -c“/u01/app/grid/11.2.0.4/bin/crsctl start resource ora.cssd -init”grid

CRS-5702: Resource 'ora.cssd' is already running on 'ip-10-10-10-10'CRS-4000: Command Start failed, or completed with errors.

CRS-5702:资源'ora.cssd'已在'ip-10-10-10-10'CRS-4000上运行:命令启动失败,或已完成但有错误。

1 个解决方案

#1


Maybe your problem is that you are forgetting to set the group:

也许你的问题是你忘了设置组:

bash "start ora.cssd" do        code <<-EOH        /u01/app/grid/11.2.0.4/bin/crsctl start resource ora.cssd -init    EOH    user "grid"    group "grid"end

I do not know for sure, but maybe the script is allowed to be run by the grid group, but not specifically by the user grid. Something like the following:

我不确定,但也许脚本可以由网格组运行,但不是由用户网格专门运行。类似于以下内容:

-rwxr-x--- 1 otheruser grid SOMEDATE /u01/app/grid/11.2.0.4/bin/crsctl

I mean, su changes both the user and the group. And that's not the case of your bash resource example, you forgot to set the group.

我的意思是,su改变了用户和组。这不是你的bash资源示例的情况,你忘了设置组。

#1


Maybe your problem is that you are forgetting to set the group:

也许你的问题是你忘了设置组:

bash "start ora.cssd" do        code <<-EOH        /u01/app/grid/11.2.0.4/bin/crsctl start resource ora.cssd -init    EOH    user "grid"    group "grid"end

I do not know for sure, but maybe the script is allowed to be run by the grid group, but not specifically by the user grid. Something like the following:

我不确定,但也许脚本可以由网格组运行,但不是由用户网格专门运行。类似于以下内容:

-rwxr-x--- 1 otheruser grid SOMEDATE /u01/app/grid/11.2.0.4/bin/crsctl

I mean, su changes both the user and the group. And that's not the case of your bash resource example, you forgot to set the group.

我的意思是,su改变了用户和组。这不是你的bash资源示例的情况,你忘了设置组。