Running su'd applications [1]

Running su'd applications

Wednesday, March 3, 2010 9:53 AM - dave


I have an xterm logged into Linux (using ssh) and displayed on my Windows desktop. All is lovely.

If I then try and execute 'sudo ethereal', no application window is displayed; instead I get

The application 'ethereal' lost its connection to the display localhost:13.0;
most likely the X server was shut down or you killed/destroyed
the application.

Similar results are obtained if I 'su' and then just try and run 'ethereal'.

I have no X-server problems running ethereal under my logged-in identity, but alas, that won't let me capture network traffic.

I suppose this is some sort of protection problem, but what to do about it?

Thanks,
dave



Program Ver. : Xmanager 3.0
Connection Method : Other


Re: Running su'd applications

Wednesday, March 3, 2010 6:23 PM - Daniel

Here is what I learned from Debian website:

Getting X11 forwarding through ssh working after running su

X authentication is based on cookies -- secret little pieces of random data that only you and the X server know... So, you need to let the other user in on what your cookie is. One way to do this is as follows:
Before you issue the su or sudo (but after having ssh'ed into the remote system), request the cookie for the current DISPLAY that's connecting to your X server:

$ xauth list $DISPLAY
You'll get something like

somehost.somedomain:10 mit-magic-cookie-1 4d22408a71a55b41ccd1657d377923ae

Then, after having done su, tell the new user what the cookie is:

$ xauth add somehost.somedomain:10 MIT-MAGIC-COOKIE-1 4d22408a71a55b41ccd1657d377923ae

(just copy'n-paste the output of the above 'xauth list' onto 'xauth add') That's it. Now, you _should_ be able to start any X application.

Link: http://www.debian-administration.org/articles/494


Previous views: 148