SUMMARY: displaying on remote hosts

From: Pravin Chavan (
Date: Mon Mar 02 1998 - 09:52:10 CST

Hi all,

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

Mariel Feder <>
Srinivasa Rao Duddupudi <>
Mr Rene Occelli <>
Mikael Nordstrom T/ED <>
Stefan Voss <>
Brian Lalor <>
"K.Ravi" <>
Mark Belanger <>
Reddy Muthyala <>
"Dmitry A. Bondareff" <>
David Thorburn-Gundlach <>
"Jeffrey K. Pado" <>
Amol Karnik <>
Rahul Roy <>
 Seth Rothenberg <>
Jochen Bern <>

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
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:


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

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

# su to the logged user to allow the displays on the machine.

# 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 (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

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

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