How to Run Linux Program in Graphical Mode from Windows Xwindow session?

Posted on 2011-10-31
Medium Priority
Last Modified: 2012-05-12
I'm trying to run an "runInstaller" program on a new Linux server in Grapical Mode. I always have nightmares trying to run Unix programs in graphical mode. And doesn't help that I'm not a Unix admin or expert.

I have installed xMing and the server isrunning. And I set Putty to use forwarding for my session.

But when I try to run the installer it gives all these errors below. It's
saying the authentication protocol attempted is wrong. I also attached the
putty settings I have.

See attached screen prints.

Can you tell if maybe I just have something setup wrong?? It's driving me crazy!!
 xming putty config1 puttty config2
Question by:matrix0511

Expert Comment

ID: 37059300
When you launched XMing, did you allow for the server to connect back to you?  I would suggest you use the XMing Luancher and select the option to "Disable Access Control".

Next, when you connect to your host with Putty, do you "su" to root before you run the GUI app?  

SSH to your server and run "echo $DISPLAY" to make sure DISPLAY is being set correctly.

if you do "su" to root, you may need to re-export the DISPLAY variable and copy the x-cookie.


$ whoami
$ echo $DISPLAY
$ su - 
# export DISPLAY=localhost:10.0
# cp ~someuser/.Xauthority ~/
# runInstaller &

Open in new window


Author Comment

ID: 37059380
@jeremycrussell, so you are saying "instead" of running the Xming Server? Or are you saying...while I still have Xming Server running to run the XLauncher as well?

Yes, when I login I have to perform the following sudo command to sudo to "oracle" which is the user that owns the installer.

I have also been running command: export DISPLAY=

See attached screen prints below. xming Launcher display setting export command sudo command

Author Comment

ID: 37059386
@jeremy, when you say"did you allow for the server to connect back to you?" what did you mean? How can I verify if it "came back to me?"
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.


Expert Comment

ID: 37059439

Yes, go ahead and kill the running xming (right-click and exit) and then run XLaunch, it simply just configures the XServer, just leave everything default, except on the third pane, check the box for "No Access Control".

Next, there is an error in your DISPLAY variable.

Log in, but before you sudo to the oracle user, run "echo $DISPLAY", next sudo to oracle user, and then run "export DISPLAY=<copy from output of previous echo command>", then copy the cookie from the user you logged in as.

This is kind of what it will look like.

$ echo $DISPLAY
$ sudo su - oracle
[sudo] password  for jburch:
$ export DISPLAY=localhost:10.0
$ sudo cp ~jburch/.Xauthority ~/
$ ./runInstaller -ignoreSysPreReqs &

The "&" just lets the GUI run in the background so you still have your CLI to do things.. it's optional..

Author Comment

ID: 37060465
Guys, i"m still having problems getting this graphical mode to work. Driving me crazy. If I just login as myself (jburch) and then run the installer the graphic app comes up. But we always sudo to "oracle" user when accessing these servers.

But when I sudo to oracle (sudo su - oracle) and then try to run the installer it doesn't come up in graphical mode. Why is that??????

Author Comment

ID: 37060467
display error

Expert Comment

ID: 37061110
Allow X11 forward in putty

Expert Comment

ID: 37063304
It doesn't look like your Xserver is running now...
LVL 19

Accepted Solution

xterm earned 2000 total points
ID: 37065837
In image export-command.jpg, you exported your DISPLAY incorrectly - it has an extra "=" sign and reads:

export DISPLAY=

That needs to be

export DISPLAY=

Try that, and then launch an X app (try something small and fast first like xterm or xeyes to make sure it works & then you can try launching your oracle app)

Expert Comment

ID: 37069685

Here I have provide some methods for run X windows program as Normal User.
However both KDE and Gnome come with tools to deal with this problem.
Method # 1:
If you are using KDE then use following command at shell prompt:
kdesu command-name
$ kdesu xeyes

Method # 2:
If you are using Gnome then use following command at shell prompt:
   $ gksuexec
Method # 3:
Create runas alias as follows:
 $ alias runas='su -c $@'
Add above alias to your bash startup script
 $ echo "alias runas='su -c $@'" >> .bash_profile
now you can use alias as follows to start any x program
 $ runas program-name
 $ runas xeyes

Method # 4: The old way
The problem is with two environment variable DISPLAY and XAUTHORITY. You need to setup them correctly to run X windows program as a root user while logged in as a normal user. So how do you fix this problem? Simply set these two variables to point to current logged in users environment variable. Let  assume you are currently login as oracle user.
Step # 1 Become super-use
  oracle@debian:~$ su -
Step # 2 Setup variables
  # export DISPLAY=0:0
  # export XAUTHORITY=/home/oracle/.Xauthority
Step # 3 Execute X program as a root user
  # xeyes


Expert Comment

ID: 37069765
The previous error you posted was one that looked like it was because the XServer wasn't running on your local PC.  Use XLaunch as I've stated previously to start XMing, remember to mark "No Access Control".

Then, SSH with Putty to the machine.

Run the following commands, after the initial login.

$ echo $DISPLAY

* Note the output, you may use this later.

$ sudo su - oracle

$ export DISPLAY=<output from previously>

$ sudo cp ~jburch/.Xauthority ~/

   Here, you are copying the X auth cookie that was created when you ssh'd into the machine with Putty and X11 forwarding.  You need to use this cookie, no matter which user you are running as on the box.   You can either set an Environment variable to the path it is, or copy it to the "current" user's directory (default location xclients look).

Now, you should be able to run any graphical applications as the oracle user, just had not changed users.

This is the process I use  to have the ability to ssh to a box as a user and su to 'root', and still be able to run graphical programs if needed.   I've added a few simple commands to the default profile of the machines to make this process automatic, works out great.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question