The configuration files for GDM are located in the etc/gdm/ directory.
This is a listing of the config directory contents:
Init/ PostSession/ PreSession/ Sessions/ gdm.conf
gdm.conf is the main GDM configuration file. The options will be described later in this chapter.
gdm.conf is configuration file for both gdm, gdmlogin, and gdmchooser since a lot of parameters overlap.
The remaining configuration is done by dropping scripts in the subdirectories of the etc/gdm folder. This approach makes it easy for package management systems to install window managers and different session types without requiring the sysadmin to edit files.
In this section we will explain the Init, PreRoot and PostRoot directories as they are very similar.
When the X server has been successfully started, GDM will try to run the script called Init/<displayname>. I.e. Init/:0 for the first local display. If this file is not found, GDM will attempt to to run Init/Default. The script will be run as root and GDM blocks until it terminates. Use the Init/* script for programs that are supposed to run alongside with the GDM login window. xconsole for instance. Commands to set the background etc. goes in this file too.
It is up to the sysadmin to decide whether clients started by the Init script should be killed before starting the user session. This is controlled with the KillInitClients option in gdm.conf.
When the user has been successfully authenticated, GDM tries to run the PreSession script. Similar to the Init-scripts, PreSession/<displayname> will be executed, if this file doesn't exist, GDM will attempt to run PreSession/Default. The script will be run as root and GDM blocks until it terminates. Use this script for local session management or accounting stuff. The $USER environment variable contains the login of the authenticated user. The script should return 0 on success. Any other value will cause GDM to terminate the current login process.
Then the session script is run. Session scripts are located in the etc/gdm/Session directory. Which one GDM runs, depends on the session the user chose in the Sessions-menu in the greeter. If no session is selected and the user has no last session stored in his ~/.gnome/gdm file, the system will choose or first script found or -- if Sessions/Default exists -- this will be run. For instance you can create a symlink from Gnome to Default to make Gnome the default desktop environment.
When the user terminates his session, the PostSession script will be run. Operation is similar to Init and PreSession. That is, GDM will attempt to execute the script PostSession/<displayname> and if that doesn't exist PostSession/Default will be run. Again the script will be run with root priviledges, the slave daemon will block and the $USER environment variable will contain the name of the user who just logged out.
Note that the PostSession script will be run even when the display fails to respond due to an I/O error or similar. Thus, there is no guarantee that X applications will work during script execution.
Neither of the Init, PreSession or PostSession scripts are necessary and can be left out. At least one session script is required for proper operation.