• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1585
  • Last Modified:

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!
0
matrix0511
Asked:
matrix0511
  • 2
1 Solution
 
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
 
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now