Login

This article is Article description::a primer about aspects of login.

What is involved in login
Login consists of several steps:
 * 1) Authentication - See Category:Authentication
 * 2) Provision of services with privilege
 * 3) Login shell invocation

In the second step, PAM organizes services. (In fact PAM works in several other cases than the step 2 above.) The last step, in which the UID is set to that of the logged in user, is described below.

Login shell in Gentoo
The most important job of a login shell is to set system-wide environment variables. In Gentoo this is done
 * for Bash and variants, by reading file, and
 * for csh/tcsh, by reading file.

See the following sections below for more details on these

This section describes Gentoo specific matters of login shells. For login shells general in Unix, see the pointer(s) in.

Default: Bash and variants
For Bash and variants, a login shell runs special configuration file(s), e.g. (and others) for bash. In Gentoo, it reads (= sources) other system-wide configuration files. These configuration files set environment variables, and do some other setups. These settings will be inherited by other shells, say opened in terminal emulators.

Load order of system-wide config files for Bash
A (bash) login shell reads:


 * The file.
 * The file.
 * Any files under the directory with a  suffix.

If the shell is bash, is also sourced. This does not configure Gentoo itself; it rather provides the Gentoo-default of bash look-and-feel.

System wide config files for Bash explained

 * Provided by (or alternatives). Other than reading other files, this file doesn't do many jobs.
 * Provided by (or alternatives). Other than reading other files, this file doesn't do many jobs.


 * This file sets environment variables. Some packages require environment variables to be set, and in Gentoo, such environment variables are collected here.
 * This file is generated from files . These files are installed by some packages (or created by config tools like eselect). For example is provided by.
 * This file is usually automatically updated. You can also manually update it by calling.
 * For the details of how is generated, see Handbook -> Environment variables -> section "Defining variables globally".
 * For the details of how is generated, see Handbook -> Environment variables -> section "Defining variables globally".


 * Some packages install files here, to be sourced by the login shell, to provide per-package configurations . It is a Unix custom, and part of the Linux Standard Base, 5.0 (2015).
 * Some packages install files here, to be sourced by the login shell, to provide per-package configurations . It is a Unix custom, and part of the Linux Standard Base, 5.0 (2015).

When these files are updated, typically, you have to re-read them again from your shell(s), for your shell to function correctly.

Tcsh
If tcsh is run as a login shell, it reads one system-wide configuration file. It reads (= sources) other system-wide configuration files. These configuration files set environment variables, and do some other setups. These settings will be inherited by other shells, say opened in terminal emulators.

A login shell of tcsh also reads. It provides tcsh-specific default behavior, and does not configure Gentoo itself.

Load order of system-wide config files for tcsh
A tcsh login shell reads files in the following order:


 * The file.
 * The file.
 * Any files under the directory with a  suffix.

System wide config files for tcsh explained

 * Provided by . (This file is distributed by Gentoo, not by the tcsh upstream.)
 * Provided by . (This file is distributed by Gentoo, not by the tcsh upstream.)


 * This file corresponds to for bash, explained above. This file is also maintained by, even if any csh-variants is not installed.
 * This file corresponds to for bash, explained above. This file is also maintained by, even if any csh-variants is not installed.


 * Similar to for bash explained above, but there is no standard for.
 * Similar to for bash explained above, but there is no standard for.

If these files are updated, typically, you have to re-read them again from your shell(s), for your shell to function correctly.

Fish
As stated in the article fish, fish can't load system-wide configuration files mentioned above. To use fish as a user's default shell, there is a good workaround detailed in the fish article.