[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#682172: unblock: couchdb/1.2.0-2



On Fri, 2012-07-27 at 22:55 +0200, Julien Cristau wrote:
> On Thu, Jul 19, 2012 at 23:43:56 +0000, Laszlo Boszormenyi (GCS) wrote:
> > On new installs /var/run/couchdb is created to store the pidfile in, but
> > as root:root . Then the couchdb user can't store its pid there, due to
> > owner problems. Filed as important, but can be RC as couchdb fails to
> > start if can't store the pidfile.
> > The fix is oneliner:
> > +++ couchdb-1.2.0/etc/init/couchdb.tpl.in
> >      mkdir -p "$RUN_DIR"
> > +    chown -R "$COUCHDB_USER" "$RUN_DIR"
> >      command="$COUCHDB -b"
> > 
> Can't the pidfile be written to before dropping privs?  chown -R feels
> rather ick, I can't see why the -R should be necessary and I can see a
> few ways it could be bad.
 Agree, -R can be problematic. What about
[ -d "$RUN_DIR" ] || (mkdir -p "$RUN_DIR"; chown "$COUCHDB_USER" $RUN_DIR")
? It would change ownership only at creation time, own that dir only to
$COUCHDB_USER . Doesn't change anything below that directory and in
fact, after its creation it'll be empty anyway.

Laszlo/GCS


Reply to: