Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: /etc/csh.login buggy?

  1. #1

    Default /etc/csh.login buggy?

    Hi,

    hostbased, not interactive ssh-connections don't get a valid $PATH-Environment because /etc/csh.login compares in line 288:

    ... && ${TERM} == "xterm" ...

    Deleting this condition corrects the problem and $PATH is set proper. We use openSUSE-11.2 and /bin/tcsh as login-shell. Within an interactive ssh-connection $PATH is ok. The probleme exists only in hostbased, not interactive sessions!

    Has anybody suggestions how to solve this problem or what's going wrong?

    -gipsy-

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: /etc/csh.login buggy?

    The code around there is:

    Code:
    #
    # An X session
    #
    if (${?TERM} && -o /dev/$tty && ${?prompt} && ${TERM} == "xterm" && ! ${?SSH_TTY}) then
            echo "Directory: $cwd"
            # Last but not least
            date
    endif
    Nothing to do with $PATH if the tests succeed, it just displays the directory and date to the screen. You're sure somebody didn't modify csh.login locally?

  3. #3

    Default Re: /etc/csh.login buggy?

    Yes, the hosts were installed several times using SuSE-11.2. All hosts showed the same behavior. So I switched back to SuSE-11.1 and everything runs proper.

    BTW: Which binary is interpreting the literal comparison within the hostbased authenticated, not interactive session, is it sshd or tcsh?!

    #############################
    linpc5 fd1501 101 /bin/tcsh
    linpc5 fd1501 101 source /etc/csh.login
    linpc5 fd1501 102 echo $TERM
    xterm
    linpc5 fd1501 103 echo ${?TERM}
    1
    linpc5 fd1501 104 tail /etc/csh.login
    #
    if (${?TERM} && -o /dev/$tty && ${?prompt} && ${TERM} == "xterm" && ! ${?SSH_TTY}) then
    echo "Directory: $cwd"
    # Last but not least
    date
    endif

    #
    # End of /etc/csh.login
    #
    #############################

  4. #4
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: /etc/csh.login buggy?

    sshd has no command line interpreter but passes control to the target's interpreter. Perhaps you are getting bash instead of tcsh for non-interactive logins, dunno? In which case you shouldn't blindly source csh.login but let the shell do that.

  5. #5

    Default Re: /etc/csh.login buggy?

    ssh-session:

    rs0 fd1501 108 ssh linpc5 printenv | grep "SHELL="
    SHELL=/bin/tcsh


    local interactive session:

    linpc5 fd1501 109 printenv | grep "SHELL="
    SHELL=/bin/tcsh

  6. #6

    Default Re: /etc/csh.login buggy?

    Running /bin/bash and sourcing /etc/csh.login crashes much earlier at line 26:

    linpc5 fd1501 118 /bin/bash
    fd1501@linpc5:~> source /etc/csh.login
    Befehl wurde nicht gefunden.
    bash: alias: path: Nicht gefunden.
    bash: alias: if ( -x /bin/\!^ ) /bin/\!*; if ( -x /usr/bin/\!^ ) /usr/bin/\!*: Nicht gefunden.
    bash: /etc/csh.login: Zeile 26: Syntaxfehler beim unerwarteten Wort `setenv'
    bash: /etc/csh.login: Zeile 26: ` if ( ! ${?TERM} ) setenv TERM linux'

  7. #7
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: /etc/csh.login buggy?

    Ok, so we have established that bash is not used at all. But I don't think line 288 is the cause of the different PATH. Rather I think you get a different path because interactive sessions source an extra config file. Possibly earlier?

  8. #8

    Default Re: /etc/csh.login buggy?

    OK, I use a completely new user with a stripped down tcsh-environment:

    --

    linpc5 /home/fd1601> cat .cshrc
    set DIRPREFIX_GLOBAL = /opt/global
    set SYSTEM_ENV = Linux
    set MACHINE_ENV = x86_64
    setenv PATH /usr/local/eclipse-3.1:/usr/local/NetBeans-4.0/bin:/usr/local/JMF-2.1.1e/bin:/usr/local/jdk1.6.0/bin:/usr/local/gcc-4.2.0/bin:/usr/local/bin:/usr/local/ssl/bin:/usr/local/pgsql/bin:/opt/SUNWspro/sunstudio12/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/teTeX-1.0.7/bin/i586-pc-linux-gnu:/usr/local/bluej-2.1.2:/usr/local/lam-7.1.4/bin:/home/fd1601/Linux/x86_64/bin:.

    --

    > /usr/bin/ssh linpc5 printenv | grep PATH
    PATH=/usr/lib64/mpi/gcc/openmpi/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin
    MANPATH=/usr/lib64/mpi/gcc/openmpi/man:/usr/share/man:/usr/local/man:/usr/local/share/man
    XNLSPATH=/usr/share/X11/nls
    LD_LIBRARY_PATH=/usr/lib64/mpi/gcc/openmpi/lib64
    > /usr/bin/ssh linpc5
    linpc5 /home/fd1601> printenv | grep PATH
    PATH=/usr/local/eclipse-3.1:/usr/local/NetBeans-4.0/bin:/usr/local/JMF-2.1.1e/bin:/usr/local/jdk1.6.0/bin:/usr/local/gcc-4.2.0/bin:/usr/local/bin:/usr/local/ssl/bin:/usr/local/pgsql/bin:/opt/SUNWspro/sunstudio12/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/teTeX-1.0.7/bin/i586-pc-linux-gnu:/usr/local/bluej-2.1.2:/usr/local/lam-7.1.4/bin:/home/fd1601/Linux/x86_64/bin:.
    MANPATH=/usr/lib64/mpi/gcc/openmpi/man:/usr/share/man:/usr/local/man:/usr/local/share/man
    XNLSPATH=/usr/share/X11/nls
    LD_LIBRARY_PATH=/usr/lib64/mpi/gcc/openmpi/lib64

    --

    ... it's still the same old problem ...

    What else can I do, exchange the /bin/tcsh, exchange sshd?

  9. #9
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: /etc/csh.login buggy?

    The man page for tcsh says that ~/.cshrc is read only if ~/.tcshrc doesn't exist. Does it? Perhaps you should put those initialisations in ~/.tcshrc.

  10. #10

    Default Re: /etc/csh.login buggy?

    It's not the .cshrc or .tcshrc. I think csh.login should be altered this way:

    #
    # An X session
    #
    if (${?TERM} && -o /dev/$tty && ${?prompt} && ! ${?SSH_TTY}) then
    if ( ${TERM} == "xterm" ) then
    echo "Directory: $cwd"
    # Last but not least
    date
    endif
    endif

    BTW: running "ssh -t ..." is running with the "original" SuSE-11.2-/etc/csh.login !!!

    I suggest sshd is sensible about touching the environmentvarible $TERM. Even the instruction

    echo ${TERM} >> /tmp/dummy.txt

    put into the csh.login changes the $PATH !!!


    Do you have any other ideas?!

    -- a nice weekend 2 u ! --

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •