0

While all my RHEL servers use "bash -l" as the default when starting a new "terminal" or "konsole" (basically executing "~/.bashrc" and "/etc/profile.d/..." scripts), I do not get this configured in Ubuntu20LTS servers.

I want to automatically execute the "/etc/profile.d/..." scripts when opening a new "terminal" or "konsole" window for all users.

But in Ubuntu20LTS this is not the case. I always have to execute "bash -l" in the new "terminal/konsole" to get the proper environment settings loaded from "/etc/profile.d/..".

How can I change the Ubuntu20LTS default settigns that the "terminal/konsole" starts a "bash -l" per default ?

HWe
  • 1

1 Answers1

0

In contrast to RHEL, the Ubuntu terminal/konsole does not automatially load the scripts under "/etc/profile.d".

By adding this to the "/etc/bash.bashrc" it basically enables the interactive-non-login-shell (when opening a terminal/konsole) to load the *.sh files under "/etc/profile.d"

if ! shopt -q login_shell; then
  if [ -d /etc/profile.d ]; then
    for i in /etc/profile.d/*.sh; do
      if [ -r $i ]; then
        . $i
      fi
    done
  fi
fi

With this setting all scripts are loaded and it "behaves" like a login shell for all users.

HWe
  • 1