previous contents up next

Unix for Advanced Users

16. X and Simple X Configuration

16.3 Graphical vs. Text Logins

In the old days, expensive memory and slow CPUs made it advantageous to stick to textual logins (X servers are known memory hogs!). Since this is no longer the case, there are now two ways to get to X: login textually then fire up X via a command like startx typed in on a command-line shell, or via a graphical login manager like xdm, which runs under an already-running X server. Recent desktop projects have written easier-to-configure replacements for xdm consistent with their look: GNOME provides gdm, and KDE provides kwm. The Common Desktop Environment, an older desktop project still installed on Solaris and HP-UX machines by default, has its own login manager called dtlogin. All of these are more or less functionally equivalent, prompting for a username and password and, in some cases, allowing you to log in to an X session on a remote machine.

16.3.1. Is my .login or .profile being used?

Normally, you set all your accustomed environment variables and aliases in one of these two files (according to the shell you are using). Will an X session honor these settings?

The short answer is no. X does not read login files on its own. However, it may inherit the settings from the environment in which it is started. If you start an X server from the command line, it will be run as a subprocess of the shell process, so it will inherit its variables. If you log in graphically--that is, if the X server is already started when you log in--your shell login variables will never be read. If you typically log in this way, you should set your environment variables in your .xsession.

Even if X inherits your environment variables as a subprocess of a login shell, it may not pass them to certain client programs. Users are commonly perplexed that variables like their prompts and paths are not passed on to xterm. That program, along with its successor rxvt, ignores those shell environment variables. That way, you are not forced to use every xterm shell as a login shell. Instead, instances of xterm take a special argument telling them whether to behave as a login shell--i.e. whether to read your .login or .profile. The argument is -ls for login shells and +ls for non-login shells. The default is +ls; hence comes the confusion.

previous contents up next