1

I have a process that runs under a nologin user (in this case Tomcat server).

I would like to execute some shell commands from that process but most of them are not available apart from standard utilities like ls, date etc...

In my particular case I want to use some scripts that are available in /usr/local and for normal login users it's enough to just source an init script in .bashrc

source for nologin users doesn't seem to be working as well as the . operator.

I've tried adding the necessary lines to /etc/profile or /etc/bash.bashrc but that also doesn't work.

Is there any other way than just copying the binaries into /bin ?

I'm using Ubuntu 14.04 right now.

0

Add /usr/local to ENV_PATH in /etc/login.defs, because The /etc/login.defs file contains a default path as follows:

ENV_PATH        PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
  • Thanks for the tip but this won't be helpful in my case. I have the following lines in my own .bashrc : export NVM_DIR="/usr/local/nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm This adds commands that are available for normal users but my nologin process doesn't execute that (he even cannot do that) thus cannot run the commands. Is there any way around this? – Kuba Dec 22 '16 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.