- From: Nico Kadel-Garcia <
>
- To: "
" <
>
- Cc: "
" <
>
- Subject: [chef] Re: Can't seem to run command in bash resource as another user?
- Date: Wed, 22 Jul 2015 09:23:01 -0500
- Accept-language: en-US
- Acceptlanguage: en-US
Try working with the "runuser" command on Linux systems, if you need to. But
I thought the bash resource supported designating a user to run the script as
directly, for just this sort of thing?
Nico Kadel-Garcia
Email:
Sent from iPhone
>
On Jul 21, 2015, at 15:07, "o haya"
>
<
>
>
wrote:
>
>
Hi,
>
>
I am trying to implement a recipe for installing an application, but I have
>
to run the installer .bin file (in the /tmp/app) as a specific user
>
"appuser",
>
>
I'm doing this in a bash resource, and have tried:
>
>
bash 'xxx" do
>
cwd "/tmp/app"
>
code <<EOH
>
su - appuser
>
./app.bin.......
>
EOH
>
end
>
>
But that doesn't seem to be work (I get an explicit error from the app in
>
the bash resource saying that I have to not be root when I run the app).
>
>
I've tried some things I've found from googling, such as:
>
>
bash "installxxxx" do
>
user "appuser"
>
cwd "/tmp/app"
>
environment ({ 'HOME' => ::Dir.home('appuser'), 'USER' => 'appuser' })
>
code <<-EOH
>
./app.bin...
>
EOH
>
end
>
>
and that if failing because it seems to still be writing some files with
>
"root" ownership, rather than with "appuser" ownership.
>
>
Can someone tell me why this (the "su - appuser" isn't working and also how
>
can I get it to work?
>
>
Thanks,
>
Jim
Archive powered by MHonArc 2.6.16.