How to Use Xming When You Use Sudo Command on Linux Server?

I am trying to run an installer program (Oracle Client Install)on a Linux server. I am using Xming for the X server and Putty.

If I use Putty and login as my personal Unix user account (jburch) onto the Linux server and make sure I have Xming Server running in the background on my local machine, when I execute the command to run the installer: ./runInstaller the graphical display works and the install wizard pops up successfully.

However, I need to run this Oracle install client install as the "oracle" user on the Llinux server. I don't have the password but the Unix admin said to just "sudo" to the oracle user.

I can run sudo to "root" or "oracle" with success. No problems.

However, as the oracle user, if i try to run the installer like i did as my personal user, it doesn't bring up the graphical install wizard like it did for my user. It gives error instead. See below.

Can someone help me to be able to sudo to oracle and still be able to get Xming to work to bring up the graphical display to install the Oracle client?

Again, this all works if I login as my personal user (jburch). so I know it works...I just need to get it to work for the oracle user.

Thanks!
matrix0511Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

matrix0511Author Commented:
Xming error in displaying install wizardPutty
0
Frosty555Commented:
I have the same issue on my server. Pretty annoying but I don't know an easy solution.

The problem is that the X11 tunnel was created using the user account that you originally logged in as. When you "su" to another user, you are now using a different user than the one that created the X11 tunnel, so any attempt at interacting with the display as that user fails.

I've come up with a couple "workarounds" that aren't perfect:

1) Use "sudo" to execute the problem directly, e.g.:

jburch@tk0089es01 >  sudo xclock

This will run "xclock" as root, but the graphics will still work.

2) Assign root an actual password, and login directly as root.

Unfortunately I don't know how to make this work with a non-root user, like your "oracle" user.


I've been meaning to find a solution to this problem, so I'll do some research for you and see if we can figure it out for the both of us.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Frosty555Commented:
Figured it out. It was actually pretty easy. Read this article:   http://froebe.net/blog/2008/11/14/getting-xlib-putty-x11-proxy-wrong-authentication-protocol-attempted-i-have-the-answer/

Here's the short version:

1) Login to your server via SSH using putty as your normal user account (e.g. jburch)

2) Figure out which display you're using:

>echo $DISPLAY

Example output:
localhost:10.0

3) List your authorization tokens

>xauth list

You'll see a list, e.g.:

yourserver/unix:12  MIT-MAGIC-COOKIE-1  ee140abcabacbasdf069901d967ba
yourserver/unix:13  MIT-MAGIC-COOKIE-1  44a56abcabacbasdfe64530d4db6ce
yourserver/unix:11  MIT-MAGIC-COOKIE-1  0e1abcabacbasdf314f9d5asfsadfe3
yourserver/unix:10  MIT-MAGIC-COOKIE-1  566519185090abcabacbasdf916d6

Copy the one whose number corresponds to the display you saw in step 1.

4) "sudo su" to the desired user account (e.g. oracle)

>sudo su - oracle

5) Add the xauth token to that user:

E.g.:
xauth add yourserver/unix:10  MIT-MAGIC-COOKIE-1  566519185090abcabacbasdf916d6

(If you get an error like "xauth:  file /root/.Xauthority does not exist", don't worry, it's just a warning and the file has now been created)

6) For this session you can now run X-windowing applications and the tunneling will work.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.