I'm having an interesting problem which I was able to work around by manually specifying PATH. The problem is that although my root user's PATH is:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binWhen I run my Puppet Master in NGINX/Passenger as user puppet, PATH somehow gets set to:/usr/sbin:/sbinWhere is the PATH environment variable set for users and how can I make sure that my puppet user has the right PATH? The user doesn't have a shell:puppet:x:103:106::/var/lib/puppet:/bin/falseIn my config.ru Rack file which is responsible for starting the Puppet Master, I've inserted the following statement to see what PATH the puppet user is running with:puts PATH:  + ENV.fetch('PATH', 'null')The output is PATH: null, therefore the PATH environment variable is simply not set when Passenger is run.I'm working in a Docker container running Ubuntu 14.04 amd64.
How is PATH set for users in puppet?
environment variables;path;puppet
As it states in the NGINX documentation:By default, nginx removes all environment variables inherited from its parent process except the TZ variable.The workaround to my specific problem can be achieved in a few different ways.Workaround 1: Append the PATH variable in RubyBy editing the config.ru file, we can simply define PATH if it isn't already defined:if not ENV['PATH']    ENV['PATH'] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binendThis is simple enough and solves the problem, but is buried in configuration you'll probably never look at again.Workaround 2: Set the PATH variable in NGINXBy setting the PATH variable in your NGINX site configuration, we have a more immediately-visible solution to the problem:server {    listen 8140 ssl default_server;    # ...    # manually set PATH for Passenger; see PUP-3000    env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin    passenger_enabled on;    # ...}