On Fri, 22 May 1998, Jacek Andreas Matulla wrote:
> > I don't know about kdm, but xdm uses two settings, found in
> > /etc/X11/xdm/xdm-config. Mine works nicely when I set paths in that
> > file, like this:
> >
> > DisplayManager._0.userPath: \
> > /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin/\
> >:/usr/bin/mh:/usr/local/Office40/bin
> > DisplayManager._0.systemPath: \
> > /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:\
> > /usr/X11R6/bin:/usr/bin/mh:/usr/local/Office40/bin
>
> O.K. I inspected all suggested files. And the console when logging in as
> root will see /usr/sbin and /sbin. Whenn logging in as a user it does
> not see /sbin and /usr/sbin. And there is NO mention of /sbin in
> /etc/profile and ~/.profile deos not even exist. There are no setting
> concerning PATH in xdm-config and running xdm with e.g. enlightenment
> will have the correct PATH but running kdm with KDE will not. I'm just
> asking me where the console and xdm take the PATH from?
When you log in at the console, the login program starts a login shell.
Login gives that shell an initial PATH, and that shell's PATH evolves
according to some specific steps taken when a login shell
starts. These steps are well-explained in the manual page for bash, near
the end. If you start X from that login shell, then your window manager
(WM) inherits the login shell's path, and any shells started by your WM
(e.g. shells running in xterms) also inherit that same path. Therefore,
people who use runlevel 5 and console logins should expect the path used
by their window manager, as well as the PATHs of all shells started by the
window manager, to be the same as the path that was set in the initial
shell that started at login time. Any differences are the result of
things that happen in the files that are sourced when different kinds of
shells are started.
When you use a display manager (DM) such as xdm, the DM sets the initial
path used by your window manager, which is inherited by the shells started
in any xterms that WM launches. There is no login shell from which PATH
is inherited.
This gets a little lengthy, but here is exactly what happens on a vanilla
Red Hat 5.0 system when various types of logins occur under bash:
1. ROOT from CONSOLE, then "startx" and xterm launch:
A. The login program sets PATH to
/sbin:/bin:/usr/sbin:/usr/bin
B. /etc/profile adds /usr/X11R6/bin, making the path
/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
C. /etc/profile looks for files ending with ".sh" in /etc/profile.d.
Seeing /etc/profile.d/mh.sh, it sources that file, adding
/usr/bin/mh to the path, making the path
/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/bin/mh
D. ~/.bash_profile adds $HOME/bin, resulting in the path
/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/bin/mh:/root/bin
E. "startx" is typed, and the WM inherits the above path.
F. xterms started by the WM are first given the above path.
2. USER "ted" from CONSOLE
A. The login program sets the path to
/usr/local/bin:/bin:/usr/bin
B-F from #1 are executed exactly the same way as above, resulting in
the path
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/bin/mh/home/ted/bin
in all xterms.
3. ANY USER from XDM:
A. xdm starts an xsession upon login. The login program is not
running, and xdm gives the WM the path
/etc/:/bin:/usr/bin:/usr/X11R6/bin:/usr/ucb
This is a very retarded path for xdm under Red Hat to set, and Red
Hat ought to fix it (/usr/ucb doesn't even exist under RH 5.0).
B. With no extra PATH manipulation by ~/.bashrc, the above path is
inherited by any xterms the WM starts.
There are a million ways you could reconcile these situations (change
various things in /etc/profile, ~/.bash_profile, or ~/.bashrc, set up
your window manager to pass an option to all xterms that makes them start
login shells, blah blah blah), but I prefer the following:
Set the xdm resources like this in /etc/X11/xdm/xdm-config:
DisplayManager._0.userPath: \
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin/:\
/usr/bin/mh:
DisplayManager._0.systemPath: \
/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:\
/usr/X11R6/bin:/usr/bin/mh:
In /etc/skel/.bash_profile, take PATH=$PATH:$HOME/bin out (along with the
PATH part of the export that follows), and put it in /etc/skel/.bashrc,
like this:
export PATH=$PATH:$HOME/bin
instead (.bashrc is sourced by .bash_profile). Write a little script
called "/usr/local/bin/redot" that looks like this:
#!/bin/sh
cp -f /etc/skel/.* $HOME/
and tell all your users to run it if their paths are annoying them.
--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--
Greg Fall
[EMAIL PROTECTED], [EMAIL PROTECTED]
http://www-personal.engin.umich.edu/~gmfall
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject.