LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   Running GUI app as root (via SSH) (https://www.linuxquestions.org/questions/solaris-opensolaris-20/running-gui-app-as-root-via-ssh-658965/)

noir911 07-29-2008 05:23 AM

Running GUI app as root (via SSH)
 
I ssh -X username@server to a Solaris 9 box as a normal user and su - to root and run /path/to/program and it says "Error: Can't open display:"

Does anyone know what I need to do to be able to run this program? Thanks.

crisostomo_enrico 07-29-2008 06:33 AM

If you su to root I think that the variable DISPLAY will not be set, while it will be set in the environment of the user which connects via ssh (you can try an
Code:

echo $DISPLAY
to check it). If that's the case, you should set it to whatever it should be, such as:
Code:

DISPLAY=youmachine:yourscreen
for example
Code:

DISPLAY=192.168.1.1:0
Hope this helps,
Enrico

noir911 07-30-2008 01:17 AM

Thanks for your help. As normal user when I do echo $DISPLAY
I get localhost:14.0. I su - to root and do export DISPLAY=localhost:14.0
and when I run the GUI app it says -

X11 connection rejected because of wrong authentication.
X connection to localhost:14.0 broken (explicit kill or server shutdown).

My local machine's echo DISPLAY is set to ":0.0" and tried to set the DISPLAY on the server as export DISPLAY=/my-local-machine's IP:0.0/ and run my GUI app again and it hangs in there - I don't see anything.

Running the GUI app as a normal user still works fine.

Any further help would be much appreciated. Thanks.

jlliagre 07-30-2008 02:51 AM

The behaviour you observe is expected. The X server thinks root is trying to hijack your user's X session.
Try using "su" not "su -" to keep your environment.

noir911 07-31-2008 12:52 AM

Thanks all for your help. I can now get the GUI.


All times are GMT -5. The time now is 11:22 AM.