login.defs & xterm -ls

login.defs & xterm -ls

Post by Don Felician » Sun, 31 Dec 1899 09:00:00




In /etc/login.defs, the default PATH is set up:

#
# *REQUIRED*  The default PATH settings, for superuser and normal
users.
#
# (they are minimal, add the rest in the shell startup files)
ENV_SUPATH     PATH=/foo
ENV_PATH        PATH=/foo

So, in /etc/profile I have:
PATH="$PATH:/bar"
export PATH

This is all well and good.  echo $PATH correctly shows /foo:/bar

However, if I invoke an xterm with -ls as an argment, echo $PATH
yeilds /foo:/bar:/bar.  My guess is that PATH is already set before
xterm runs through /etc/profile (which has PATH=$PATH:/bar).

Why does this happen?  What's the workaround?

I have "XTerm*loginShell: true" in my ~/.Xdefaults file, so this
behavior is an annoyance in all of my xterms by default.  I like the
login shell invoked b/c I have aliases, PS1 prompts, etc getting set
in .profile and .kshrc

 
 
 

login.defs & xterm -ls

Post by Ken Pizzi » Sun, 31 Dec 1899 09:00:00


On Wed, 18 Aug 1999 18:49:14 GMT,


>In /etc/login.defs, the default PATH is set up:
...
>So, in /etc/profile I have:
>PATH="$PATH:/bar"
>export PATH

>This is all well and good.  echo $PATH correctly shows /foo:/bar

>However, if I invoke an xterm with -ls as an argment, echo $PATH
>yeilds /foo:/bar:/bar.  My guess is that PATH is already set before
>xterm runs through /etc/profile (which has PATH=$PATH:/bar).

>Why does this happen?  What's the workaround?

Where are you invoking this xterm from?  I would guess from some
shell that already has $PATH set up with /foo:/bar.  "xterm -ls"
does not invoke login, so the /etc/login.defs file is not
getting run, so the PATH is not being reset to just /foo, and
the login-startup of the shell is unconditinally appending :/bar
to whatever PATH it is inheriting.

One solution is to modify your /etc/profile to only append /bar
if it isn't already in your $PATH:
  case :$PATH: in
    *:/bar:*) ;;
    *) PATH=$PATH:/bar ;;
  esac
  export PATH

                --Ken Pizzini

 
 
 

1. xdm & login.defs

Has anyone found a way for xdm to process /etc/login.defs?  As far as I
can tell, login.defs is part of login or shadow password.  It's not a shell
script file.  The only way I have seen is to run an xterm client in the
Xsession file.

Jonas

(I have Linux 2.0.3x, Slackware 3.4, XFree86 3.3.2, bash.)

2. detecting rs-232 ports

3. Inter terminal communication in AIX, using C

4. Ftape & /etc/login.defs

5. SLS update: newspak, ps

6. Failed logins - login.defs

7. stty tostop & SIGCHLD

8. Need source to login that uses /etc/login.defs

9. shadow passwd - login.defs

10. /etc/limits and /etc/login.defs with agetty

11. /etc/login.defs

12. HZ variable in shadow-mk login.defs