2
I'm running a GitLab server on a Linux machine using Nginx as a Webserver.
Several processes (started either manually as root with /etc/init.d/foo start
or automatically as sub-processes) run as different users:
- nginx as www-user
- postgres as postgres
- redis-server as redis
- unicorn-rails and sidekiq as git
The user git is configures as no-login, I'm usually using sudo -u git -H foo
to do stuff as user git.
The user has installed an executable (node.js) in a local path. To use it, I need to change my sudo to
sudo -u git -H env "PATH=/home/git/local/bin/:$PATH" foo
. I've also added it to the .bashrc file of user git, but I suppose that is never executed as shell login is forbidden.
As I'm having problems with the GitLab server, I'm suspecting that the service does not have the PATH variable correctly set and can't find node.js in the local path.
My Question:
How do I set environment variables such as PATH for non-login users, so that services running as this user (started by root with /etc/init.d/foo start
or on boot) have access to it?
Bonus Question: Which process/user would need access to the Javascript engine? Nginx/www-user? Or Rails(Unicorn)/git?