Solved

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

Posted on 2012-04-04
3
1,387 Views
Last Modified: 2012-05-10
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
Comment
Question by:matrix0511
  • 2
3 Comments
 

Author Comment

by:matrix0511
ID: 37809215
Xming error in displaying install wizardPutty
0
 
LVL 31

Accepted Solution

by:
Frosty555 earned 500 total points
ID: 37809350
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
 
LVL 31

Expert Comment

by:Frosty555
ID: 37809364
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now