What happens when you log in?

Updated: May 06, 2022

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:

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:

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.