This class and its members can be considered a stable interface and will not change in a backwards-incompatible fashion between releases of unicorn. Knowledge of this class is generally not not needed for most users of unicorn.
Some users may want to access it in the before_fork/after_fork hooks. See the Unicorn::Configurator
RDoc for examples.
user (user, group = nil, chroot = false) source
In most cases, you should be using the Unicorn::Configurator#user
directive instead. This method should only be used if you need fine-grained control of exactly when you want to change permissions in your after_fork or after_worker_ready hooks, or if you want to use the chroot support.
Changes the worker process to the specified user
and group
, and chroots to the current working directory if chroot
is set. This is only intended to be called from within the worker process from the after_fork
hook. This should be called in the after_fork
hook after any privileged functions need to be run (e.g. to set per-worker CPU affinity, niceness, etc)
group
can be specified as a string, or as an array of two strings. If an array of two strings is given, the first string is used as the primary group of the process, and the second is used as the group of the log files.
Any and all errors raised within this method will be propagated directly back to the caller (usually the after_fork
hook. These errors commonly include ArgumentError for specifying an invalid user/group and Errno::EPERM for insufficient privileges.
chroot support is only available in unicorn 5.3.0+ user and group switching appeared in unicorn 0.94.0 (2009-11-05)
mail archives: https://yhbt.net/unicorn-public/ http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/unicorn-public/ nntps://news.public-inbox.org/inbox.comp.lang.ruby.unicorn nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.unicorn nntp://news.gmane.io/gmane.comp.lang.ruby.unicorn.general imaps://;AUTH=ANONYMOUS@yhbt.net/inbox.comp.lang.ruby.unicorn.0 imap://;AUTH=ANONYMOUS@7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.unicorn.0 public: unicorn-public@yhbt.net source code: git clone https://yhbt.net/unicorn.git torsocks git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/unicorn.git