UvA FNWI UvA


 
  1 visitors in
February 2012
 
  last update
26 - 09 - 2004
 
 

 

Logging in on UNIX, using X-Windows and CDE

Introduction

When you log in on a UNIX workstation the login-screen may come in any one of the following three flavours:

  • A character oriented login screen.
  • The Common Desktop Login (CDE) dialog box.
  • The X Display Manager (XDM) dialog box.

Depending on the login screen the system presents to you, a number of different, though similar, steps are executed before you can work with the system.

A complicating factor in the sequence of steps is the login shell you use. This may be either a Bource shell like shell (sh, ksh, bash) or a C-shell like shell (csh or tcsh). Each of these families of shells execute different startup scripts.

Below you'll find a description of the files executed and how and when to modify them.

Please note that all the startup scripts have hooks to tune them to your particular needs without resorting to modifying the startup scripts themselves. These hooks are provided to allow for easy upgrading to new versions of the startup scripts as they become available.

Login screen

The character oriented login screen looks like this:

login:
password:

To the first prompt you type your username, to the second prompt your password.

Then, depending on your login shell the following scripts are executed.

For Bource shell-like shells these are:

  • $HOME/.profile
  • $HOME/.env.sh (if it exists)
  • $HOME/.aliases.sh (if it exists)
  • /usr/local/scripts/interface.sh

For C-shell like shells the scripts are:

  • ~/.cshrc
  • ~/.env.csh (if it exists)
  • ~/.aliases (if it exists)
  • ~/.login
  • /usr/local/scripts/interface.csh

$HOME and ~ are notations for your homedirectory for the two families of shells.

The .profile (.cshrc) are started automatically for every shell you run.

The .env.sh (.env.csh) is started from the .profile (.cshrc). This file is intented for environment variables that you may want to define.

The .aliases.sh (.aliases) is also started from .profile (.cshrc) once the .env.sh (.env.csh) has completed execution. The .aliases.sh (.aliases) is intented for storing aliases for commonly used commands. In the Bourne shell family of shells only the Bourne shell itself does not support aliases, the other ones do.

Once the aliases are read, the C shell starts the .login script, which in turn runs the /usr/local/scripts/interface script. For Boure shell /usr/local/script/interface.sh is started directly from the .profile.

/usr/local/scripts/interface.sh (interface.csh) presents a menu from which you can choose:

Interface?

f     Fvwm95
o     OpenLook Window Manager
ov    OpenLook Virtual Window Manager
t     Tab Window Manager
tv    Tab Virtual Window Manager
p     shell   (default)

The interface script detects if you are logging in on a graphics display. If your loggin in on a character oriented terminal or via a network connection the interface script will not print anything and continue as if you had chosen option "p".

If you choose "p" the sequence of scripts stops and the shell is ready to accept commands. In this case you'll have no graphics interface to the system, just a shell that you can type commands to.

X Window Manager

If you choose anything else from the options presented by /usr/local/scripts/interface.sh (interface.csh), you will get one of the many flavours of the X-window system. The main difference between these options is the window manager that will be started for you.

At the time this document was written 5 commonly used window managers are supported:

optiondescriptionwindow mgr
fFvwm95fvwm95
mMotif Window Managermwm
oOpenLook Window Managerolwm
ovOpenLook Virtual Window Managerolvwm
tTab Window Managertwm
tvTom's Virtual Tab Window Managertvtwm

Suppose you chose "f" for the fvwm95 window manager. In that case the following scripts are executed:

  • /usr/local/X11/bin/XSUN
  • .xinitrc (from your homedirectory)
  • .fvwm95-init (from your homedirectory)

For all window managers the last file executed is different:

window mgrstartup script
Fvwm95.fvwm95-init
Motif Window Manager.mwm-init
OpenLook Window Manager.openwin-init
OpenLook Virtual Window Manager.openwin-init
Tab Window Manager.twm-init
Tab Virtual Window Manager.tvtwm-init

Note that the olvwm and olwm window managers share a single startup file. These window managers are part of Sun's OpenLook package. They are almost identical except for olvwms support for a vitual desktop larger than the physical screen size.

X Init Script

The window manager startup scripts listed in the table in the previous paragraph are different for all window managers. This allows for different desktop definitions for each of the window magagers.

A typical window manager init script looks like:


#!/bin/sh
xterm -C -n console -geometry 58x9+0+0 -fn 6x10 +vb -title console &

eval `xwininfo -root | awk '/Width:/{print "W="$2}/Height:/{print "H="$2}'`
screen()
{
    [ $3 = r ] && off=1
    echo +"`expr $W \* $1 + $W \* ${off:-0} / 2`"+"`expr $2 \* $H + 145`"
}

xterm -geometry 80x55`screen 0 0 l` &
xterm -geometry 80x55`screen 0 0 r` &

It starts a console window, which is used by many X applications for logging errors. If you do not have it error message will be printed on the desktop.

The shell function "screen" is a handy routine to place windows anywhere on a (virtual) desktop. "screen 0 0 l" calculates the correct coordinates for a window to be placed on the left half of the screen. "Screen 1 0 l" places a window on a virtual screen immediately to the right of the main screen.

The screen function syntax is: screen x y {l|r}. X and Y are virtual screen numbers counting from (0,0) in the top-left corner of the virtual desktop. The third parameter may be "l" or "r" denoting the left or right half of the virtual screen.

The window manager init scripts may be modified freely.

Init scripts for all supported window managers are automatically installed in your home directory when your account is created.

If, for any reason, you need to restore the original startup script (e.g., for the tvtwm window manager), do the following (note the dot at the end of the second command):

cd
cp /usr/local/scripts/.tvtwm-init .

Resource Files

Each window manager uses its own "resource file" to store menu definitions and other definitions like fonts, colors and icons.

The resource files, located in your homedirectory are:

window mgrresource file
Fvwm95.fvwm95rc
Motif Window Manager.mwmrc
OpenLook Window Manager.olwmrc
OpenLook Virtual Window Manager.olvwmrc
Tab Window Manager.twmrc
Tab Virtual Window Manager.tvtwmrc

The window manager resource files may be modified freely.

Resource files for all supported window managers are automatically installed in your home directory when your account is created.

If, for any reason, you need to restore the original resource file (e.g., for the tvtwm window manager), do the following (note the dot at the end of the second command):

cd
cp /usr/local/scripts/.tvtwmrc .

.login file

The .login file is a file executed only the C-shell like shells. It is executed only for the very first shell started immediately after you login.

Contrary to popular belief it is started after the .cshrc has run.

The default .login does nothing more than run the script /usr/local/scripts/interface.csh.

A .login file is automatically installed in your home directory when your account is created.

You should not modify it.

.profile file

The .profile file is executed for each new shell you start from the family of Bourne-shell like shells. It is the very first file executed.

The default .profile does the following:

  • run the softpkg program
  • read environment variable definitions from .env.sh
  • read aliases from .aliases.sh

A .profile file is automatically installed in your home directory when your account is created.

You may modify it, though most changes can also be implemented by adapting your .pkgrc, .env.sh and .aliases.sh file.

If you need to add software packages (ie., change your path variable definition), change or add aliases or environment variables, see softpkg.

.cshrc file

The .cshrc file is executed for each new shell you start from the family of C-shell like shells. It is the very first file executed.

The default .cshrc does the following:

  • run the softpkg program
  • read aliases from .aliases
  • read environment variable definitions from .env.csh

A .cshrc file is automatically installed in your home directory when your account is created.

You may modify it, though most changes can also be implemented by adapting your .pkgrc, .env.csh and .aliases file.

If you need to add software packages (ie., change your path variable definition), change or add aliases or environment variables, see softpkg.

.pkgrc file

The .cshrc and .profile files execute a program called "softpkg".

Softpkg is program that automatically builds your search path. It completely hides operating system revision and architecture dependencies from your .cshrc or .profile. An extensive manual for softpkg is available using

    $ man softpkg

once logged in on a unix system.

Adding a package to your work-environment is very easy. Suppose you want to use the Gnu C compiler (gcc), you edit the file .pkgrc and add the line

gcc
Then for C-shell like shells, do:
source ~/.cshrc

For Bourne-like shells, do:

. $HOME/.profile

A .pkgrc file is automatically installed in your home directory when your account is created.

You are free to modify it.

If you need to refer to directories directly, as opposed to predefined installed packages, you can also include absolute pathnames in your .pkgrc file.

Package names remain the preferred way to build your seachpath, since you won't be affected when an installed packages is moved to another directory in the filesystem.