Operating System - HP-UX
1832343 Members
2443 Online
110041 Solutions
New Discussion

Re: connecting to HP-UX from linux

 
SOLVED
Go to solution
Guy Humphreys
Valued Contributor

connecting to HP-UX from linux

Morning all,

Has someone got any tips on how to connect to HP-UX boxes from a linux client.

I can connect just by using telnet and ssh from a command line, however the problem I have is with glance whenever I use it all the bars etc are messed up and there are lots of erroneous characters on screen - any tips greatly received.

Also, does anyone know how to change the title bar of gterm (or any terminal app for that matter) to show which UX box I am connected to?

Both of these things would help me get rid of windows for good off my desktop!

(I am using Opensuse 10 just for info)

thanks a lot
Guy
'If it ain't broke, don't fix it!'
11 REPLIES 11
Steven E. Protter
Exalted Contributor

Re: connecting to HP-UX from linux

Shalom,

openssh is a default package on all Linux.

http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=T1471AA

Is the HP-UX equivalent.

This openssh connection is the best and most secure way to handle connectivity and even script and control issues. It can be made password free when needed.

HP-UX machines in general do not change the title bar due to TERM, terminal or TERMCAP issues.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Guy Humphreys
Valued Contributor

Re: connecting to HP-UX from linux

Thanks for the reply SEP, I am not too concerned with what protocol I use to connect, it is more the emulation mode I am concerned with w.r.t Glance.

I have attached a screenshot of me using glance over a ssh login - it ain't pretty!

And you say that in general HP-UX won't alter the titlebar. To me, that means that it MAY do so in extreme circumstances (I am an eternal optimist :)) surely someone else must login from linux istead of from windows? I have trouble keeping track of which machine I am in at any particular time with multiple connections on the go.

I have to continually do a "uname -a" before any other commands to make sure I am on the correct box - it gets quite annoying as you can imagine.

Thanks again to anyone who can help
Guy

'If it ain't broke, don't fix it!'
Guy Humphreys
Valued Contributor

Re: connecting to HP-UX from linux

Doh! Let's try and attach the attachment this time!!!

Guy
'If it ain't broke, don't fix it!'
Coolmar
Esteemed Contributor

Re: connecting to HP-UX from linux

Hi Guy,

I know you would prefer the hostname to show in the xterm, but how about putting it in the prompt...at least you would always know what server you are on and would save you from doing uname all the time.

Add to your .profile :

PS1="`hostname`# "

Hope that helps,
Sally
Guy Humphreys
Valued Contributor

Re: connecting to HP-UX from linux

Thanks Sally, I had thought about this and may well end up using it, it's a good fix but not 100%. The reason I wanted it on the title bar is so I can see the server name when it is minimised on the taskbar.

Cheers
Guy
'If it ain't broke, don't fix it!'
Peter Nikitka
Honored Contributor
Solution

Re: connecting to HP-UX from linux

Hi,

you can include an escape sequence in your prompt to include text in the header or icon text of dtterm or just echo one to perform a one-time entry.

At login time I use to set the icon title to LOGNAME@HOST:

HOST=${HOST:-`uname -n`}
case "$TERM" in
iris-ansi*)
print -n '\033P3.y'$LOGNAME@$HOST'\033\\'
;;
xterm|aixterm|dtterm)
print -n '\033]1;'$LOGNAME@$HOST'\007'
;;
esac

To include the working directory name, I use:
...
case "$TERM" in
*hpterm)
PS1="$LOGNAME@$HOST[!] ^[&f0k\${#PWD}D\$PWD"
;;
xterm|aixterm|dtterm|vt200)
PS1="^[];$LOGNAME@$HOST:\${PWD#$HOME/}^G^M$LOGNAME@$HOST[!] "
;;
...


Note, that the characters '^[' in the PS1 string are escape characters.

You can try, if gterm uses one of my existing entries. Else check the documentation for escape chars used there and expand the 'case' statement as neeeded.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Steve Lewis
Honored Contributor

Re: connecting to HP-UX from linux

If you have X windows, then why not just run gpm instead of Glance?

Simply set your xhosts on the Linux client, the DISPLAY on the HP-UX server and run gpm for full gui luxury.

I change the title using a function in my .profile

function settitle
{
case $TERM in
xterm|dtterm)
echo "\033]0;$1\007\c"
;;
hp*)
echo "\033&f0k${#1}D$1\c"
;;
*)
;;
esac
}
PS1=$(settitle '[$LOGNAME]'`hostname`:'${PWD}')^M'[$LOGNAME]'`hostname`':${PWD}> '


The ^M really is a control M.

Alexander Skwar
Frequent Advisor

Re: connecting to HP-UX from linux

And if you use bash as your shell, you'll find the following useful:

PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'


In bash, $PROMPT_COMMAND is evaluated before a prompt is shown. What the above will do, is that the xterm title is updated before every prompt and it'll always show the current $USER@$HOST:$PWD

Reg. PATH in prompt: I've got:

PS1='[\[\033[01;31m\]\t \[\033[01;39m\]\u\[\033[00m\]@\[\033[01;35m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]] $ '

It'll show a nice colourful prompt, like this:

[09:30:24 vz6tml@dewup-ww02:/tmp] $

It's not too colourful, though - see attachment. Also not the title of the window.

Bill Hassell
Honored Contributor

Re: connecting to HP-UX from linux

Glance is totally dependent on the terminal you use and was originally designed for HP terminals (nothing like a vt100 or other dumb terminal). So the emulator you use is extremely important as well as ensuring that HP-UX identifies the terminal automatically. Unfortunately, the standard /etec/profile and .profile bypass terminal identification if the remote system provides the TERM value as part of the telnet protocol. Since Linux sends over a TERM=linuxterm or something similar, everything falls apart because the login profile accepts this as accurate (there is no such terminal for HP-UX) and Glance sends incpompatible codes to the terminal. Or you may be using Xwindows and the default behavior is to totally ignore profiles.

In either case, the profiles should be corrected ($HOME/.Xdefault should have *loginShell: true for the source of the emulator) and the if statement about TERM="" in profiles should be removed and replaced with: eval $(ttytype -s)

Now that the terminal can be correctly set in HP-UX, Glance still works better in an HP terminal, so I would start hpterm rather than dtterm or xterm. You get the full size for softkey labels and video enhancements work correctly. NOTE: Glance is designed for 80x24 screens and the default Xwindow behavior for resizing a window is to change the number of characters and lines, not make the font larger. This is not handled well by Glance -- after all, you can't make a dumb terminal like a vt100 100x50 chars/lines. By using .Xdefaults on the HP-UX side, you can select a larger font, set screen colors and even the window title while allowing Glance to run as it was designed.

So 'borrow' hpterm from the HP-UX server for displaying Glance and all will be well. Otherwise, make sure that ttytype -s is eval'ed as you login so TERM matches your terminal window and is know to the terminfo database (hint: ll /usr/lib/terminfo/*/*)


Bill Hassell, sysadmin
Guy Humphreys
Valued Contributor

Re: connecting to HP-UX from linux

Thanks to all for some very helpful solutions.

It was Steve in the end who showed me the way. Just use gpm!! - brilliantly simple

I had not even considered using it - too used to console based glance.

got my display and xhost sorted and got it running, however upon running it remembered why I don't use it - not as nicely setout as character based glance (IMHO) but carried on with the X server theme and launched a hpterm and then ran glance from that - got my old favourite glance back and the host name in the titlebar automagically by using the X version of hpterm - sweet.

thanks again to all
Guy
'If it ain't broke, don't fix it!'
Guy Humphreys
Valued Contributor

Re: connecting to HP-UX from linux

thread closed
'If it ain't broke, don't fix it!'