.login and .logout Files
What .login and .logout Do
Your .login and .logout files send commands to the UNIX shell, often setting or unsetting UNIX environment variables that control how certain UNIX commands behave.
How .login and .logout Work
When you log in, the UNIX shell consults your .login file and runs the commands in it. In particular, the UNIX shell reads your .login file to find other UNIX commands and to determine what type of windowing system you want to run.
Similarly, when you log out, the UNIX shell reads your .logout file and runs the commands in it.
Global .login and .logout Files
Sourcing the global .login and .logout
Your .login and .logout files probably contain lines which "source," or run, the commands in the global .login and .logout files. These lines are of the form:
source /usr/local/lib/global.logi
and
source /usr/local/lib/global.logout
Where to put the source commands
The source line for global.login should be the first command in your .login file. If you make changes to .login, make them below this line.
The source line for global.logout should be the first command in you .logout file. If you make changes to .logout, make them below this line.
The global.login file
The /usr/local/lib/global.login file sets these things:
- The search path your UNIX shell will use to find programs.
- The editor UNIX uses by default.
- Your time zone variable.
- A tmp file used for zephyr communications.
The global.logout file
The global.logout file executes the unlog command, telling the AFS distributed file system to delete your authentication tokens from this particular session. The global.logout file also stops zephyr and cleans up any local Xauth cookies if appropriate.
Making Changes to Your .login
Setting your terminal type
If you want AFS to ask about setting the terminal type when you log in via telnet, add the following code to the end of your .login file:
if ($term == "" || $term == "network" ||$term
== "telnet" || $term == "su")
then
echo -n "Terminal type [vt100] ? "
set term=$<
if ($term == "") set term="vt100"
set -I Q
endif
Note: You may set the terminal type to something other than vt100 (e.g., zenith, vt220, etc.).
Setting the windowing environment
All new Andrew accounts automatically start the X11 windowing system and fvwm2 whenever the user logs in. This is accomplished by means of the line:
source /usr/local/lib/global.startwindow
in the user's .login file.
There are, however, alternate window managers a user may choose to run, twm (Tab Window Manager), or a user may decide not to use any window manager and just work from the system console. Which windowing environment you choose will depend on your personal preference, as well as the capabilities of the machine you may be using.
Computing Services recommends using X11 and fvwm2. All the Andrew workstations in public clusters work very well with X11 and fvwm2.
For more information about the default Andrew window environments, see The Andrew Window Environment.
Specifying command line arguments to the Xserver
Your .login file is also the place where you issue commands to the Xserver upon login, using the environment variable XSERVERAGRS.
For example, if you want to make sure that a GrayScale server is started when you login to the machine named freehold, which you know has a GrayScale display, you could put something like the following in your .login file:
#if on freehold, make sure I get a GrayScal
# server
if (`hostname` == freehold.andrew.cmu.edu)
then
setenv XSERVERAGRS "-cc 1"
endif
The -cc switch would be used when running the MIT X servers (like SPARCstations and other non-DEC servers), while the -class switch would be used when running the DEC X servers.
The Display classes are as follows:
- #define StaticGray 0
- #define GrayScale 1
- #define Static Color 2
- #define PseudoColor 3
- #define TrueColor 4
- #define Direct Color 5}
Note: These arguments for the Xserver must appear before the source /usr/local/lib/global.startwindows line, which should appear at the end of your .login file.
Modifying your search path
You can modify the search path that UNIX uses to find programs you want to run. See the Search Paths: Using Search Paths on Andrew section for an explanation of the search path and how to modify it in your .login file.
Logging Out vs. Quitting
The difference between logging out and quitting is that logging out takes you completely out of the AFS system, while quitting takes you out of the window manager and back to the system prompt.
Some users may prefer to just quit the window manager without logging out of the system (this is useful if you want to do things outside of X, like restart X to test a change you made without having to log back in).
In order to quit, rather than log out:
- Add the following line to your .login file, before the line that sources the global.startwindows:
setenv NO_LOGOUT_ON_QUIT ""
Note: This environment variable will have an effect only if you have started your windowing environment via the global.startwindows mechanism, and not until your next login. Once you have set this variable, choosing Logout/Quit from the menu will quit the windowing environment and place you back at the system prompt. From there you will have to type logout to log out of the system.
Last Updated: 11/7/05