Login

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

Login consists of several steps:
 * 1) Authentication - See Category:Authentication
 * 2) Provision of services with privilege - PAM organizes services, and also works in several other cases.
 * 3) Login shell invocation

On effective shell invocation, the UID is set to that of the logged in user, then any shell initialization scrips are invoked, as described below.

Login shell startup scripts and environment variables
One 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
 * for csh/tcsh, by reading file.

The following sections concentrate on Gentoo login shells. For general information about login shells in Unix, see the.

Bash and variants - default
For Bash and variants, starting a login shell sources (executes in current process, conserving environment) configuration scripts, e.g., among others. These configuration files set environment variables, and perform some setup. These settings will be inherited by other shells, say opened in terminal emulators.

A bash login shell reads, in order:


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

is also sourced - this does not configure Gentoo itself, but provides the Gentoo-default bash look-and-feel.

System wide config files for Bash

 * 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., but can also be manually updated by calling.
 * For details of how is generated, see Handbook -> Environment variables -> section "Defining variables globally".
 * For 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).

Tcsh
When tcsh is run as the login shell, it reads one system-wide configuration file,, which then sources other system-wide configuration files. These configuration files set environment variables, and do some other setup. These settings will be inherited by other shells, say opened in terminal emulators.

A tcsh login shell also reads, which provides some tcsh-specific default behavior, but does not configure Gentoo itself.

A tcsh login shell reads files in the following order:


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

System wide config files for tcsh

 * 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 when no csh, or variant, is installed.
 * This file corresponds to for bash, explained above. This file is also maintained by, even when no csh, or variant, is 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.

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.