User can have multiple ways to login and different OSes, different shells have different approach. As I always search for same information, I decided to collect them here.
To understand what's going on here, you need to understand a little background information about how shells (bash in this case) are run.
- When you open a terminal emulator (gnome-terminal for example), you are executing what is known as an interactive, non-login shell.
- When you log into your machine from the command line, via ssh, or run a command such as su username, you are running an interactive login shell.