[chef] Re: Can't seem to run command in bash resource as another user?


Chronological Thread 
  • From: Jeff Blaine < >
  • To:
  • Cc:
  • Subject: [chef] Re: Can't seem to run command in bash resource as another user?
  • Date: Wed, 22 Jul 2015 09:06:49 -0400

> 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

That's the right approach, though there's no reason to set those 2
environment variables.

> and that if failing because it seems to still be writing some files with 
> "root" ownership, rather than with "appuser" ownership.

Are you making /tmp/app in Chef and specifically setting the 'owner'
attribute to 'appuser' as well? What files are coming up root-owned?

-- 
Jeff Blaine
kickflop.net
PGP/GnuPG Key ID: 0x0C8EDD02



Archive powered by MHonArc 2.6.16.

§