SUMMARY: displaying on remote hosts

From: Pravin Chavan (prchavan@pcsbom.patni.com)
Date: Mon Mar 02 1998 - 09:52:10 CST


Hi all,

Here's the summary. The following deserve thanks for their
responses:

Mariel Feder <mfeder@central.meralco.com.ph>
Srinivasa Rao Duddupudi <sduddupu@cvimail.cv.com>
Mr Rene Occelli <rene@iusti.univ-mrs.fr>
Mikael Nordstrom T/ED <Mikael.Nordstrom@era-t.ericsson.se>
Stefan Voss <s.voss@terradata.de>
BILLY <billy@smug.adelaide.edu.au>
Brian Lalor <blalor@hcirisc.cs.binghamton.edu>
"K.Ravi" <RAVKRISH.IN.ORACLE.COM.ofcmail@in.oracle.com>
Mark Belanger <mark_belanger@ltx.com>
Reddy Muthyala <rmuthyala@lhxperts.com>
"Dmitry A. Bondareff" <dmitry@mmk.ru>
David Thorburn-Gundlach <david@bae.uga.edu>
"Jeffrey K. Pado" <jkp@cdicad.com>
Amol Karnik <amol@memcad.com>
Rahul Roy <uroy@eadev1.vanguard.com>
 Seth Rothenberg <SROTHENB@montefiore.org>
Jochen Bern <bern@penthesilea.uni-trier.de>

I have used the program suggested by Mariel Feder (given
below) : (I have created a user and this script becomes
the login shell for the user)

--------------------------------------------------------------
You have to run xhost + with the user that is actually logged to the
machine.
The solution for this, is make your script su to that user, before
issuing the xhost +.
Of course this means that only root will be allowed to run this script.

I would suggest something like:

#!/bin/ksh

#To verify that root is the one running this script
if [ `whoami` != "root" ]; then
        echo
        echo "You must be root to run this script"
        echo
        echo
        exit 1
fi

#to get the user who is on the console
loguser=`rsh itws2 who | awk '$2=="console"{print $1}'`
if [ "X$loguser" ="X" ]
then
    echo "There is nobody on the console"
    exit
fi

# su to the logged user to allow the displays on the machine.
MYDISPLAY=remotehost:0.0
export MYDISPLAY

# If the login shell of the user is csh, use this line
su - $loguser -c "(setenv DISPLAY $MYDISPLAY; /usr/openwin/bin/xhost +)"

#If the login shell of the user is ksh or sh, use this line
# su - $loguser -c "(export DISPLAY=$MYDISPLAY; /usr/openwin/bin/xhost +)"

---------------------------------------------------------------------

Before I execute the above program, I have done the following:

"touch /usr/lib/.text_extra_menus" on the remote machines.

This is one time job and optional as it only helps in eliminating
a few error messages.

I can run the above program as an ordinary user also !!!!!

Many people have warned against the usage of xhost +. But this can
be taken care of by including an "xhost -" command at the end of the
above program. In my case I display a window warning the user that
his machine will be shutdown. So I don't compromise on any security
feature since the machine goes down after that.

---------------------------------------------------------------------
Billy Constantine has given the following suggestion (I haven't tried
it out but intend to do so):

if remotehost supports the .rhosts security "feature", you can use that in
combination with xauth, eg:

xauth nlist $DISPLAY | rsh remotehost "xauth nmerge -"
rsh remotehost "xterm -d $DISPLAY -e myprog"&

the xrsh program, available from ftp.x.org/contrib/applications (i think) is
good for this, doing it all in a single step i think - i don't use it anymore
since .rhosts got disabled on my machines...

since then, i've had to rely on a perl hack that i co-wrote with a former
sysadmin on one of the systems i use in a non-sysadmin capacity... i can send
it to you if you like; with some minor tweaking, it might suit your
purposes...
---------------------------------------------------------------------

I am not including other replies, because they either tell something
similar to the above two replies OR they are not in context to the
question I had asked (misunderstood my mail, maybe !!!!)
======================================================================

The original question
---------------------
** Hi sunners,
**
** I am writing a simple script which will open a window
** on remote monitors and display certain messages. The
** line in the script looks like this -
**
** rsh remotehost xterm -d remotehost:0.0 -e myprog
**
** This produces the foll. error message:
** Xlib: connection to "remotehost:0.0" refused by server
** Xlib: Client is not authorized to connect to Server
** Error: Can't open display: remotehost:0.0
**
** So I try :
**
** rsh remotehost xterm -d remotehost:0.0 -e xhost +
**
** But this doesn't work either (whether I do it as root
** or as an ordinary user).
**
** Is there any way in which I can override the xhost setting
** on a remote host and open a window there?
**
** Thanks. Will summarize to the list.
**
** BTW: our setup has Solaris 2.3, 2.4, 2.5 and 2.5.1 AND few
** machines have CDE running on them.
**
** Regards,
**
** Pravin
** prchavan@pcsbom.patni.com
**
**



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:32 CDT