PID file ownership and group

Eric Wong normalperson at
Tue Sep 20 14:03:14 EDT 2011

Lee Hambley <leehambley at> wrote:
> I'm using unicorn in an environment with /very/ strict permissions
> (one might so as far as to say that the sysadmin is being too careful)
> and I've observed that when starting Unicorn via `upstart` (runs as
> root) with unicorn.rb configured to suid and sguid, the logs and other
> files are correctly owned by `selected user:group` but the pidfile is
> owned by root:root. Owing to very restrictive unmasking and other
> permissions, this file is not readable by any lower-level users, and
> thus one has to be root to read the pidfile.
> What's the logic here, is it a bug, an oversight or an intentional
> design, naturally one can use `ps` or any other number of ways to get
> a pid, so protecting the pidfile doesn't seem like a security concern/

I didn't think of it until now, but I don't think it's necessary to
expose.  With the exception of creating Unix domain sockets, unicorn
always respects the umask given to it, and unicorn only changes
permissions inside worker processes.

Also, nginx (where unicorn draws many design elements from) does not
change the permissions of the pid file, either.

> Of course this is somewhat academic, as one must be root to signal the
> process anyway, but I'll cross that particular bridge when I come to
> it!

Yeah, there's no point in knowing it unless you can send signals to it.

Eric Wong

More information about the mongrel-unicorn mailing list