SUMMARY- Can't run X after SUing to newuser

From: Craig Gruneberg (clg@zygote.csph.psu.edu)
Date: Mon Apr 29 1996 - 13:54:39 CDT


Here is the original question:

*******************************************************
>From clg Mon Apr 29 10:07:40 1996
To: sun-managers@ra.mcs.anl.gov
Subject: X Access with SUing

When I create a new account I su - to that user and then I need
to run an X application. It looks like since I have become that user
via a root shell, the user cannot access the display. I get the
following error:

 ERROR: Cannot open X display. Check display name/server access authorization.

So I thought I had to use xhost to not only see who has permissions to
connect but to also add new users to the list. If I type xhost once I
have SU'ed to the newuser, I get:

xhost: unable to open display ""

so I tried xhost + before I SU'ed with the following results:

# /usr/openwin/bin/xhost + newuser@
newuser@ (unix.1003@.domain) being added to access control list

# /usr/openwin/bin/xhost
access control enabled, only authorized clients can connect
unix.1003@.domain

but I get the same error once I su - to the newuser.

Any ideas on how to allow this su'ed newuser access to the display??

I am running Solaris 2.5, Openwin 3.5 on a Ultra 1.

*********************************************************
The solution was to disable xaccess control before Su'ing. I would
have preferred a solution that left the control on and just provided
access for the new user but this will do.

The replies to my post follow:

....................
....................

From: Sahir Siddiqui <sahirns@menger.eecs.stevens-tech.edu>

After you su to the other user, you have to set the display -
bash$ export DISPLAY=yourdisplay:0
or
csh> setenv DISPLAY yourdisplay:0

or you can set the display in your commandline as:
% xterm -d yourdisplay:0 &
....................
....................

From: willid7@thorin (DonWilliams)

You need to set the DISPLAY environment variable
once you've su'd.
echo $DISPLAY before su'ing to see what it should be.
....................
....................

From: sumanth@cis.ufl.edu

after you have "su" 'ed try the following:

        setenv DISPLAY <displayname.dom.ain>:0

                where <displayname.dom.ain> is specific to your case.
....................
....................

From: sumanth@cis.ufl.edu ( His reply #2 )

ok.... do the following from the begining.....

your-prompt> xhost + (make sure that this is your original login on the machine
                                                        and not an rlogin)
your-prompt> su - <user>
his-prompt > setenv DISPLAY cdmas.noll.psu.edu:0.0
his-prompt > sas

(if it still doesn't work.... why don't you rlogin instead of su-ing)

(if it still doesn't work ... try to send me the output right from "xhost +" on
        and also the output of "env" after having done all the above)
....................
....................

From: Robert Fulwiler <bobf@psa.pencom.com>

Craig-
Since you did su - and given the messages you are recieiving, check the
DISPLAY environment variable and make sure it is set correctly.
Bob
....................
....................

From: Richard Pieri <ratinox@unilab.dfci.harvard.edu>

You are using X authority for authentication. With this enabled, each
user that is allowed access to your X server must have an authority
record for your X server in the .Xauthority file in that user's home
directory.

You can get more information about xauth and authentication mechanisms
from the xauth(1) man page.
....................
....................

From: andre@dragon.cpqd.br (Andre Novaes Cunha)

Before su on machine foo:

# /usr/openwin/bin/xhost +

After su - user:

% setenv DISPLAY foo:0
% <run X application>

PS: Of course all of the commands above are issued inside openwindows.
....................
....................

From: Justin Young <justin@mesun12.engr.subr.edu>

Simple add the name of the machine to your /etc/X0.hosts file.

E.g. from machine mesun12
mesun12
mesun1
mesun2
mesun3
mesun4
mesun5
mesun6
mesun7
mesun8
mesun9
mesun10
mesun11
hds1
hds2

Although you probably only need one machine.

This should do it. However, you don't xhost the user, you xhost the host.

Add the file and you shouldn't have to worry about permissions.



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:59 CDT