1832870 Members
2934 Online
110048 Solutions
New Discussion

Strange tty behaviour

 
SOLVED
Go to solution
Tony Walker
Frequent Advisor

Strange tty behaviour

Hi All,

I have a weird problem. When I telnet into machine x I login in fine - no errors. When I rlogin, the profile develops an error which I have traced to the use of `tty` to determine the device file. When rlogged in, typing tty produces "not a tty" (which is where the profile error comes from) and when I type ps I get "ps: don't know which terminal to select".

Can anyone help?

Thanks,

Tony
7 REPLIES 7
harry d brown jr
Honored Contributor

Re: Strange tty behaviour


Do you have something like this in your .profile??

# Set up the terminal:
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs

echo
echo "Value of TERM has been set to \"$TERM\". "
export TERM

EDITOR=vi
export EDITOR

fi # if !VUE

Also, are you telnet'ing or rlogin'ing(?) from another unix box or from a M$ PC? If so, what software (terminal emulator) are you using?


live free or die
harry
Live Free or Die
Tony Walker
Frequent Advisor

Re: Strange tty behaviour

Harry, this is where the error is occuring:

# Set TERM variables
#
if [ `tty` = /dev/console ]
then
if [ $LOGNAME = "root" ]
then
TERM=hp
else
TERM=wyse50
fi
WSID=no
else
TERM=vt220

I'm telnetting/rlogin from another HP machine.

Cheers
harry d brown jr
Honored Contributor

Re: Strange tty behaviour

Tony,

rlogin, then issue:

tset -r

What term type is returned?

Your script, ON the CONSOLE, will set root to termtype=hp and any other account on the console to "wyse50".

All other locations will set the TERM to vt220. Are you exporting TERM?

live free or die
harry
Live Free or Die
Tony Walker
Frequent Advisor

Re: Strange tty behaviour

Harry, when I type in tset -r I get "Terminal type is vt220
Erase is Backspace
Kill is Ctrl-U"

And TERM is exported a few lines further down than the ones I've detailed above.
harry d brown jr
Honored Contributor

Re: Strange tty behaviour


login and type in:

alias

Is "ps" redefined (aliased) ??

Do an "ls -l /dev/pts", do you have any, if so then how many?

Also, try these:

# grep telnet /etc/inetd.conf
telnet stream tcp nowait root /usr/lbin/telnetd telnetd
# ls -l /usr/lbin/telnetd
-r-xr--r-- 1 bin bin 94208 Sep 16 2002 /usr/lbin/telnetd
# what /usr/lbin/telnetd
/usr/lbin/telnetd:
Copyright (c) 1983, 1986 Regents of the University of California.
Patch ID: PHNE_24829
#

Also, type in "env".

Also, are you loggin in as "root" or a "common" user??


live free or die
harry
Live Free or Die
Bill Hassell
Honored Contributor
Solution

Re: Strange tty behaviour

Your code is really unnecessary since HP-UX identifies terminals automatically with the program ttytype. Replace all your TERM= code with:

eval $(ttytype -s)

You will always have terminal problems when you set TERM= something since the script has no idea what is conected. All it takes is a user to change emulators or options on a terminal and the hardcoded TERM= will create problems. By using ttytype, the TERM value will be set automatically (as long as the terminal behaves like one of the several dozen models listed in /usr/lib/terminfo)


Bill Hassell, sysadmin
Tony Walker
Frequent Advisor

Re: Strange tty behaviour

Thanks guys.

Alas I've come in this morning and the problem no longer exists:| Bill, I'll look into implementing the use of ttytype instead - looks like its about time some of our machines got a rewrite!

Cheers,

Tony