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 This is a complicated question, more so than people think. Among many attempts to explain it that you have no doubt found is this one: https://linuxize.com/post/bashrc-vs-bash-profile/ but the short answer is there is no good way to do this for everything, you need to have your use case(s) in mind and mapped out and provide for each of them. Just when you think you've got it figured out, another comes along, so try, rinse, and repeat if needed.
.bashrc vs .bash_profile: What is the Difference?

Understand the difference between .bashrc and .bash_profile, when each file is loaded, and where to put aliases, PATH changes, and environment variables.

Linuxize