What happens when you log in?
Before you start customizing your login environment, you should understand just what happens when you log in, because the nature of the customization determines where you should make it.
You should consider these questions:
- Does this change apply to all users, or just to me?
- Do I need to do something only when I first log in, or whenever I start a shell?
When you log in, the system starts the login shell that's specified in
your entry in the account database (see
/etc/passwd
in Managing User Accounts).
The login shell is typically sh, which is usually just a link
to the Korn shell, ksh.
When ksh starts as a login shell, it executes these profiles, if they exist and are executable:
- /etc/profile
- $HOME/.profile
Why have two profiles? Settings that apply to all users go into /etc/profile; your own customizations go into your own .profile. As you might expect, you need to be root to edit /etc/profile.
There's actually a third profile for the shell.
The special thing about it is that it's executed whenever you start a shell; see
ksh's startup file,
below.