Set PATH variable for users without home directory

Hi,

Is there is way to globally set a default PATH variable? I'm running some daemons installed from binaries from users without home folder and the daemons need to run commands but can't find the binaries because there seems no PATH variable to be set. Its working if I edit all scripts to use absolute paths ("/usr/local/bin/mysql" instead of just "mysql") but that can't be the right way.

How to do this right if there is no home folder to place a ".shrc" or ".profile" in it?
 
Its working if I edit all scripts to use absolute paths ("/usr/local/bin/mysql" instead of just "mysql") but that can't be the right way.
I'm not sure there is "one right way". Actually, I'm sure there isn't. But this is a really good way, because it makes the script independent of global configuration settings such as the path, and more self-supporting. On the other hand, it means that every single script becomes more dependent on file system layout. On FreeBSD, you can pretty much rely on that being quite standardized (see "man hier"), on other OSes less so. But maybe you don't like it, in which case: fine, have it your way. There is more than one way ...

How to do this right if there is no home folder to place a ".shrc" or ".profile" in it?
There are several other places where the default path is set. One is /etc/login.conf, but I'm not sure that is executed when a shell is started without a login. The next one is: There are system-wide configuration scripts for each shell, for example /etc/profile and /etc/csh.cshrc. You could modify those. To know which ones to modify, read the man page for the shell your scripts are using. Typically, that can be found in the first line of the script, the so-called shebang line, typically starts with "#!/bin/sh ..."
 
Back
Top