How to set DISPLAY?

How to set DISPLAY?

Post by Bin » Wed, 31 Mar 1993 10:18:34



If the computer I am working at and the computer that I want to remotely
logon both run a Unix operating system and xwindows, I have to set DISPLAY
on the remote machine in order to open a window on my local computer. I am
interested in that how to get my local computer name and set DISPLAY
automatically when I logon the remote machine. For security reasons, I could
not use "x" command. I couldn't use "xrsh" because the remote
machine doesn't have "xauth". Does anybody know how I can get the local
computer name and operating system (AIX or SunOS) automatically when I logon
a remote machine?

Thanks in advance

-Bin

 
 
 

How to set DISPLAY?

Post by Michael Salm » Wed, 31 Mar 1993 17:21:13


|> If the computer I am working at and the computer that I want to remotely
|> logon both run a Unix operating system and xwindows, I have to set DISPLAY
|> on the remote machine in order to open a window on my local computer. I am
|> interested in that how to get my local computer name and set DISPLAY
|> automatically when I logon the remote machine. For security reasons, I could
|> not use "x" command. I couldn't use "xrsh" because the remote
|> machine doesn't have "xauth". Does anybody know how I can get the local
|> computer name and operating system (AIX or SunOS) automatically when I logon
|> a remote machine?

The easiest way is to use whoami or equivalent to determine the remote
machine and then set DISPLAY, this has problems if you don't use
display 0 or the remote machine's name is longer than 16 characters.

# set display if possible
if ($term =~ x*) then
    set displayhost=`who am i | sed -e 's/.*(//' -e 's/).*$//'`
    if ("$#displayhost" == "1") then
        setenv DISPLAY $displayhost\:0
    endif
    unset displayhost
endif

--

Michael Salmon

#include        <standard.disclaimer>
#include        <witty.saying>
#include        <fancy.pseudo.graphics>

Ericsson Telecom AB
Stockholm

 
 
 

How to set DISPLAY?

Post by Panagiotis Spiliopoul » Wed, 31 Mar 1993 23:23:18



> If the computer I am working at and the computer that I want to remotely
> logon both run a Unix operating system and xwindows, I have to set DISPLAY
> on the remote machine in order to open a window on my local computer. I am
> interested in that how to get my local computer name and set DISPLAY
> automatically when I logon the remote machine. For security reasons, I could
> not use "x" command. I couldn't use "xrsh" because the remote
> machine doesn't have "xauth". Does anybody know how I can get the local
> computer name and operating system (AIX or SunOS) automatically when I logon
> a remote machine?

Try uname -a (or man uname); this is valid for SunOS and IRIX.

Quote:

> Thanks in advance

> -Bin

Greetings Takis

-----------------------------------------------------------
"And God shall wipe away all tears from their eyes and    |
 there shall be no more Death. Neither sorrow, nor crying.|
 Neither  shall there be any more Brain; for the former   |
 things are passed away."                                 |
                          Revelations, XXI                |
-----------------------------------------------------------



SWITZERLAND        |                                      |
+41 1 920 36 89    |                                      |
-----------------------------------------------------------

 
 
 

How to set DISPLAY?

Post by Paul E. Carro » Thu, 01 Apr 1993 23:39:56



>If the computer I am working at and the computer that I want to remotely
>logon both run a Unix operating system and xwindows, I have to set DISPLAY
>on the remote machine in order to open a window on my local computer. I am
>interested in that how to get my local computer name and set DISPLAY
>automatically when I logon the remote machine. For security reasons, I could
>not use "x" command. I couldn't use "xrsh" because the remote
>machine doesn't have "xauth". Does anybody know how I can get the local
>computer name and operating system (AIX or SunOS) automatically when I logon
>a remote machine?
>Thanks in advance
>-Bin

I have found a solution to this problem that works wonderfully.
The solution is in 3 parts.
Part 1, I have the following file in my bin dir called rl:
------
#!/bin/sh
if [ -n "$DISPLAY" ]; then
        case "$DISPLAY" in
        :*)
                DISPLAY=`hostname`$DISPLAY
                ;;
        esac
        TERM="$TERM&$DISPLAY"
        export TERM
fi
xhost +$1 1> /dev/null 2>&1
rlogin $*
cd .
-------------
Part 2, I have the following lines in my .cshrc on ALL that machines I might
log on to.  (Even if I don't do it in a window.)
-------------
if ( $?TERM ) then
        if ( `echo $TERM | tr -cd '&'` != '' ) then
         setenv DISPLAY `echo $TERM | awk "-F&" '{print $2;}' `
         setenv TERM `echo $TERM | awk "-F&" '{print $1;}' `
        endif
endif
---------------
Part 3, I start up a remote window for whatever machine like this:
---------------
xterm -sl 150 -sb -T Phoenix -e /home/pec2/bin/rl phoenix
--------------
Where Phoenix is the name of the remote machine and pec2 is my uid.

This works GREAT!  I can have aliases to pop up remote windows and I have
entries in my menu files so I can use the mouse to pull up a remote window.

Hope this helps.

--
-Paul Carroll


-NSF Engineering Research Center for Computational Field Simulation

 
 
 

1. setting DISPLAY

Please comment on the follwoing problem:

Doing an rlogin or a telnet to another machine the DISPLAY variable is not
propagated. Therefore I have to figure out the machine (mostly a PC) where the
X-server is currently running. But how?? Under RedHat 5.0 it would be no
problem since the who -m command shows the correct display, however, this is
not the case on other systems.

Any ideas?

Thanks
    Thomas

2. Q: What's the newest version of Amanda ???

3. setting $DISPLAY env var

4. OPTi MAD16

5. setting $DISPLAY in CDE on 2.6

6. Can I rebuild the rpm database from scratch?

7. setting display on PC?

8. AMD / VIA bug?

9. ThinkNIC: ssh not setting $DISPLAY ?

10. set DISPLAY with PPP, How?

11. Newbie - Setting Display Resolution

12. setting DISPLAY for remote login

13. How to set DISPLAY to the correct machine?