The login sequence

It's worth understanding at least those files in the login sequence that will affect things like whether you can login in the first place, where your initial environment comes from, and so on. At the risk of over-simplifying, here are the files you need to worry about that are invoked/consulted every time you log in (indented in an attempt to show who actually consults who):

/etc/passwd                     1
/etc/shadow                     2
/etc/group                      3

/etc/profile                    4
/etc/profile.d/*.sh             5

~/.bash_profile                 6
~/.bashrc                       7
/etc/bashrc                     8


/etc/passwd defines, among other things, the username, numeric UID and GID of the user, the home directory and the login shell. For security reasons, the encrypted password is no longer stored in this file.


/etc/shadow represents a more secure place to store things like the encrypted password, password aging information and more. (This is the only file in this list of files that requires root privilege to display.)


/etc/group defines the working groups on the host, along with the users who are members of those groups.

4 5

/etc/profile represents the top-level startup/customization file that is invoked by each user. In addition, this file may, toward the bottom, invoke all of the customization files in the directory /etc/profile.d, which typically represent a small amount of customization on a per-application or per-command basis. If you're confused about where some login environment setting is coming from that seems to be affecting the behaviour of a particular command, this is a good place to look.

6 7 8

These two startup files in the user's home directory are for configuring the user's personal environment. In addition, on some Linux systems, the default .bashrc may invoke the global /etc/bashrc file, for one final dose of environment configuration and customization.

As a final helpful hint, once you get logged in, there are two handy commands that can tell you everything there is to know about your identity and group affiliations:

$ id
$ groups