[Setup] buildout install not as a root user on Linux

Larry Pitcher unclelarry at inlandnet.com
Fri Nov 30 17:34:50 UTC 2007


jcfinet wrote:
> I 've created a normal user "toto" and install the product with it , then
> launch the bin/instance fg as root;
> 
> I tried 2 case:
> 
> 1) put the effective user toto in the zope.conf and no such a line in
> buidout, it works;
> 
> 2) or put it in the buildout and no in the zope.conf, it doesn't work very
> well;
> 
> so I'm a bit confusing with 'who' and 'where' to put it;
> 
> (for the moment it's a development machine but it'll be a production machine
> in a few months;)
> 
> 
> 
> 
> [instance]
> recipe = plone.recipe.zope2instance
> zope2-location = ${zope2:location}
> user = user_name:passwd
> 
> # effective-user = plone or plone or toto ? and is it necessary to put this
> line here ?
> 
> http-address = (port number)
> debug-mode = on
> verbose-security = on

Hi,

You're on the right track with your buildout.cfg. You should make 
changes in the buildout.cfg, not in your zope.conf, because changes in 
buildout.cfg are transfered to zope.conf the next time you run 
./bin/buildout. If it looks like changes are not taking effect, maybe 
you're forgetting to run ./bin/buildout?

I keep my buildout in svn, so when I make changes I have to 1) save the 
file locally, 2) commit my changes to svn, 3) "svn up" in my buildout 
machine, 4) run ./bin/buildout, 4) restart zope.

About the user you run under - for testing it's easy to just use your 
own user. I could install everything under /home/larry/zope/ and I would 
have the proper permissions, etc. and if I was logging in as myself, not 
root, it would all run just fine.

Since we run our production machines with the user zope, I also set my 
development buildouts up to run as this user. I just add the user on my 
development box and then configure my buildout.cfg with the 
"effective-user=zope" command.

There's one more thing, though... when I'm doing development and 
sysadmin work on a remote box, I'm usually logged in as "larry" or 
"root", so that causes permissions issues for the "zope" user and my 
buildout. I need to be logged in as "root" to make certain changes to 
the system (okay, I could use sudo), and I don't like to change users a 
lot, so I've added a section to my buildout.cfg to make sure that the 
buildout belongs to the "zope" user. It uses the "chown" command.

I add a line in my "parts" section so that it looks like this:

-----------------------------------
parts =
     plone
     zope2
     productdistros
     instance
     zopepy
     chown
------------------------------------

Then I put the "chown" section at the end of my buildout.cfg like this:

-------------------------------------
[chown]
recipe = plone.recipe.command
command =
     chown -R ${instance:effective-user} ${buildout:directory}
update-command = ${chown:command}
---------------------------------------

Of course, for this to work, you have to run ./bin/buildout as "root", 
or some other user who has permission to use the "chown" command on your 
buildout directory.

This isn't in any of the documentation, and maybe someone will speak up 
and say that it's not the best way of doing things, but it's working for 
me.

HTH,

-- 
Larry Pitcher
Catapult Solutions

Email: larry.pitcher at gmail.com
Skype: larry.pitcher
Phone: 509.849.2660



More information about the Setup mailing list