In the ubuntu server I run, I added customisations in /etc/bash.bashrc and as .sh files in /etc/profile.d, to add some useful aliases and functionalities for my users. All of them run correctly for my account.

However, logging into other accounts (including ones in the same groups as mine), be it via su or ssh, these customisations aren't loaded. Manually running . /etc/profile does the trick, but afaik this should happen automatically at startup in interactive login shells. Running echo $0 from all accounts returns -bash, so I assume they effectively are in such shells.

Why else could this be happening, and how can I fix it?

  • The RC and profiles in /etc are only executed if the user does not already have one of their own in their home directory. If one is present, and you wish to also execute the default profile or RC file, simply add a call to source the relevant file in the personal configuration in the relevant users' home directories.
    – DopeGhoti
    Apr 16, 2018 at 22:24
  • This sounds inaccurate, since I have both and both get sourced normally. In my understanding, the only possible issue with having both is that whatever is set into ~/.profile overrides /etc/profile.
    – kadu
    Apr 16, 2018 at 22:34
  • This link might help It may be that your bash wasn't compiled with the -DSYS_BASHRC flag?
    – brandon
    Apr 16, 2018 at 22:58
  • 1
    Start a login shell with bash -lx to see what exactly gets executed on startup.
    – chepner
    Apr 18, 2018 at 3:27
  • @chepner your suggestion together with [diffchecker]{diffchecker.com} helped me solve my issue, thanks.
    – kadu
    Apr 18, 2018 at 19:53

2 Answers 2


I encounter the same problem. I found my solution while checking the /etc/profile file

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
  unset i

So it's only check .sh files (Ubuntu 18). I have renamed my /etc/profile.d/conda to /etc/profile.d/conda.sh and now it works as intended!


Anything in ~/.profile and ~/.bashrc is run after /etc/profile and /bash.bashrc. As such, any aliases or variables set in the first will supersede those set in the latter if they share the same name.

For whoever this might help: the specific issue I was facing is because I'm migrating servers, and I've asked my users to backup any important files they had and put it back in the new server. When they did this, they included ~/.bashrc because it had "the trick that makes python work" (i.e. it was setting the PATH variable to include the anaconda directory), as well as some of the customisations I had made to their computers in the previous server. This was in conflict with new aliases I'm setting (e.g. the alias for source activate, which became conda activate), and as of conda 4.4, conda.sh should be added to /etc/profiles.d/ rather than manually setting the PATH variable.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .