Linux sysadmin question (since it's no longer possible to find actual answers via search on the Internet):

How can I configure the PATH to *always* have a specific directory in it when a shell (Bash) is started, regardless of whether the shell is login/non-login, interactive/non-interactive, etc.?

The normal steps (adding a file in /etc/profile.d which adds to the path) work for login/interactive shells, but not for shells opened by sshd with a command to execute (no pty).

#Linux #SysAdmin #LinuxSysAdmin

@kevin In Ubuntu it could be /etc/environment and/or /etc/security/pam_env.conf.

But it is processed by pam, (man pam_env), so you probably have to set UsePAM yes in /etc/ssh/sshd_config.

You can also add Environment option in ssh.service and define PATH for sshd process and it's children.