1832212 Members
2448 Online
110041 Solutions
New Discussion

DISPLAY after telnet

 
SOLVED
Go to solution
Joseph P. Marino
Occasional Advisor

DISPLAY after telnet

HOST=`uname -n`
/usr/bin/X11/xhost +$HOST

This is what I added to my .profile to allow me to run RSAM.
However when I telnet to another box
I always have to do export DISPLAY=xxx.xx.xx.xxx:0.0

I also created .Xdefaults file with *loginShell: True
should i do that for all users with SAM access

What I would like to do is automatically detect the IPs or name of the PC the users on and put export DISPLAY in they .profiles so they can use RSAM

Thanks

12 REPLIES 12
RAC_1
Honored Contributor

Re: DISPLAY after telnet

On every user's .profile

export DISPLAY=$(who -um|awk '{print $NF}')

Anil
There is no substitute to HARDWORK
Muthukumar_5
Honored Contributor

Re: DISPLAY after telnet

We can get our login informations with ip-address who command as,

export DISPLAY=$(getip `who -mu | awk '{ print $NF }'|tr -d '()'`| awk '{ print $4}'):0.0

It will do your requirement there.

Don't use who -um there. It will reply with hostname there. It can not be used to set DISPLAY parameter.

HTH.


Easy to suggest when don't know about the problem!
Sanjay_6
Honored Contributor

Re: DISPLAY after telnet

Hi,

Try this in your .profile

export DISPLAY=`who -mu |awk '{print $8}'`:0.0

hope this helps.

Regds
Muthukumar_5
Honored Contributor

Re: DISPLAY after telnet

Hai Sanjay,

IF we use,
export DISPLAY=`who -mu |awk '{print $8}'`:0.0

It will give ip-address / resolved hostname there. There is a possibility as, given ip-address can be reolved and display as (hostname) or (FQDN)

We can avoid that with getip call.

getip host will give ip-address.

export DISPLAY=$(getip `who -mu | awk '{ print $8 }' | tr -d '()'`:0.0)

HTH.
Easy to suggest when don't know about the problem!
Joseph P. Marino
Occasional Advisor

Re: DISPLAY after telnet

I forgot to add one little ...very small detail telnet from pc-> unix-> unix. <- this box sees I.P of unix box however I need to see pc I.P

Sorry
Muthukumar_5
Honored Contributor

Re: DISPLAY after telnet

Related link to this. Based on linux as,
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=686016

HTH.
Easy to suggest when don't know about the problem!
Sundar_7
Honored Contributor

Re: DISPLAY after telnet

"very small detail telnet from pc-> unix-> unix. <- this box sees I.P of unix box however I need to see pc I.P"

I dont believe this is possible. The second UNIX box can only recognize the source connection (which is the first UNIX box).

Do you have remsh/ssh capablities from UNIX2 to UNIX1 ? - If yes, you can do a little scripting. Other than that, there is no elegant solution for this, atleast as far as I can tell.
Learn What to do ,How to do and more importantly When to do ?
Muthukumar_5
Honored Contributor

Re: DISPLAY after telnet

We can get the login interface ip-address on remote server as,


netstat -na | grep '' | grep '23'

It will give information there about remote server on 4 column.

We can get as,

IP=$(getip `who -mu | awk '{ print $NF }' | tr -d '()'`)

SERVER_IP=$(netstat -na | grep '$IP' | grep '23' | awk '{ print $4}')

23 -- telnet port number.

export DISPLAY=$IP:0.0

HTH.
Easy to suggest when don't know about the problem!
Sanjay_6
Honored Contributor

Re: DISPLAY after telnet

Hi Joseph,

I doubt you can do that, since the connection from pc -> unix1 -> unix2 does not have have any way of letting the unix2 box find out the ip address of pc. the connection to unix2 is going from unix1 and that is the only connection info that unix2 is going to get.

Muthukumar,

If the system is unable to resolve the FQDN, it will gibe the ip address over there in place of the FQDN. If the system is able to resolve the ip address to a FQDN, it should work, else it would be getting the ip address in the first place itself.

Hope this helps.

Regds
Jan Sladky
Trusted Contributor

Re: DISPLAY after telnet

Hi Joseph,

uname -a assign name of remote box (from your point of view) you need to assigne your hostname, so use the who -um

enter following into .profile

export DISPLAY=`who -um|awk '{print $8}' | tr -d '()' | awk '{print $1}'`:0.0

this will work

br Jan
GSM, Intelligent Networks, UNIX
Muthukumar_5
Honored Contributor

Re: DISPLAY after telnet

Sanjay,

FQND resolvation will be used when hostname is resolved there on who and IP-Address will be used given on who else. But we can not set hostname / FQDN on DISPLAY variable there.

It will make problem, other the ip-address there to set. To avoid this problem, I am using getip to make host --> ip-address. It will return ip-address for ip-address too, so no problem there.

DISPLAY will be using IP-Address bit maps there with window number with : there.


HTH.
Easy to suggest when don't know about the problem!
Bill Hassell
Honored Contributor
Solution

Re: DISPLAY after telnet

Don't get into the habit of using telnet to go from one computer to another to another to another...there is no way to easily determine where the PC is located or how many hops away it is located.

*loginShell is a specific Xwindow resource that changes the way 3 specific programs work: hpterm, dtterm and xterm. These programs run on the HP-UX side and are only needed when a character mode interface is used. When DISPLAY is setup correctly, SAM (and swinstall, etc) will use the GUI and not xterm/dtterm/hpterm. The only time you need these terminal emulators is when you're using a system with a graphics display or using a PC and 'borrowing' a desktop display from another server.


Bill Hassell, sysadmin