[英]User attribute not working in bash resource of chef recipe
I am trying to run one command as grid user. 我试图以网格用户身份运行一个命令。
Code-1 is not working. 代码1不起作用。 Giving permission not available error. 授予权限不可用错误。
code-2 is working. 代码2正在工作。 What is the issue? 有什么问题
Code-1 代码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 代码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"
EOH
end
I am not able to understand why bash is not able to run that command as grid user in code-1 snippet 我不明白为什么bash无法在代码1片段中以网格用户的身份运行该命令
Exact error log for code-1 snippet: 代码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启动资源ora.cssd -init”网格
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:命令启动失败,或由于错误而完成。
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
. 我不确定,但是也许脚本可以由grid
组运行,但不能由用户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. 我的意思是, su
会同时更改用户和组。 And that's not the case of your bash
resource example, you forgot to set the group. 而且, bash
资源示例并非如此,您忘记了设置组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.