[chef] Re: Re: Re: switch between root and non-root user within a chef script


Chronological Thread 
  • From: JD Harrington < >
  • To:
  • Subject: [chef] Re: Re: Re: switch between root and non-root user within a chef script
  • Date: Thu, 25 Jul 2013 17:43:05 -0400

I'm saying run chef as your user. Just sudo at some point before, like a bootstrap script that also installs chef or a small wrapper, to modify /etc/sudoers. Assuming you don't want to leave passwordless ssh around, you can change it back with a recipe at the end of the run.

Ranjib's suggestion might be better, though. That configuration wasn't in the homebrew cookbook last time I used it!

On Thu, Jul 25, 2013 at 5:35 PM, Andrew Sharp < " target="_blank"> > wrote:
Thanks, the passwordless sudo idea might be the best option. But what about the Homebrew problem? If I called the Chef script with sudo, Homebrew would deliver an error. It won't be run as root.


On Thu, Jul 25, 2013 at 2:32 PM, JD Harrington < " target="_blank"> > wrote:
You can either enable passwordless sudo by modifying /etc/sudoers (at least for the life of the chef run) or sudo once before running chef, which will allow you to continue to sudo without a password for the length of your sudo timeout, which I believe is 5 minutes by default.


On Thu, Jul 25, 2013 at 5:19 PM, Andrew Sharp < " target="_blank"> > wrote:
Hi,

I'm writing a cookbook to set up a development environment on OS X. This cookbook installs packages via Homebrew as well as .dmg packages. I am using the homebrew cookbook
for the homebrew packages, and the dmg cookbook for the .dmg packages.

I would like the script to run without any user input. Since the .dmg packages require root permissions, they stop the script for the user to enter their password. This could be alleviated by running the script with sudo. However, Homebrew requires that it be run as non-root, so I cannot run the script with sudo.

Any suggestions?

Thanks,


Andrew






Archive powered by MHonArc 2.6.16.

§