<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: Remotely starting local X application?</title>
	<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application/</link>
	<description>Comments on Ask MetaFilter post Remotely starting local X application?</description>
	<pubDate>Fri, 16 Nov 2007 21:22:33 -0800</pubDate>
	<lastBuildDate>Fri, 16 Nov 2007 21:22:33 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: Remotely starting local X application?</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application</link>	
		<description>How do I restart an X Windows application running on a remote machine, and have it display on that computer&apos;s locally-attached display? (I &lt;i&gt;do not&lt;/i&gt; want to forward/tunnel it to the machine I&apos;m sitting at.) &lt;br /&gt;&lt;br /&gt; Two computers, foo and bar. Foo is a machine connected to a big display, but lacking any local controls (keyboard or mouse). Bar is a laptop. Foo normally runs an X Windows application, but sometimes this application crashes.&lt;br&gt;
&lt;br&gt;
How can I, by connecting to foo from bar via SSH, restart an X app running on foo, and have it come back up on foo&apos;s display? All the resources I can find on the net deal with forwarding X connections so that I could display them remotely on bar (which I can do fine), but that&apos;s not what I want. I want to issue the command via SSH, but have the application display itself on the local display. (And once I get it running, I want to close down the SSH connection.)&lt;br&gt;
&lt;br&gt;
I&apos;m sure it has something to do with the DISPLAY variable, but I can&apos;t figure out what to set it as. (I&apos;ve tried setting it to &quot;localhost:0&quot; and &quot;127.0.0.1:0&quot; as well as &quot;:1&quot; on both, but both give &quot;can&apos;t open display&quot; errors.)&lt;br&gt;
&lt;br&gt;
It seems like this ought to be a lot easier than tunneling an X connection, but I&apos;m stumped.&lt;br&gt;
&lt;br&gt;
&lt;small&gt;This is all using Knoppmyth, which is Debian/X11.org-based, with Bash.&lt;/small&gt;</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2007:site.76470</guid>
		<pubDate>Fri, 16 Nov 2007 21:16:09 -0800</pubDate>
		<dc:creator>Kadin2048</dc:creator>
		
			<category>linux</category>
		
			<category>xwindows</category>
		
			<category>x</category>
		
			<category>mythtv</category>
		
			<category>bash</category>
		
			<category>networking</category>
		
			<category>ssh</category>
		
	</item> <item>
		<title>By: mkb</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136192</link>	
		<description>You need 0&lt;b&gt;.0&lt;/b&gt; on those DISPLAY values. Also, if you want to discojnnect your SSH session without blowing away your X client, run it through nohup or use the disown command in bash. (or never mind if you are using tcsh)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136192</guid>
		<pubDate>Fri, 16 Nov 2007 21:22:33 -0800</pubDate>
		<dc:creator>mkb</dc:creator>
	</item><item>
		<title>By: Kadin2048</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136197</link>	
		<description>If I set DISPLAY=0:0, I get &quot;Can&apos;t open display&quot; errors. (Same for 0:1.)&lt;br&gt;
&lt;br&gt;
Good suggestion, though...</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136197</guid>
		<pubDate>Fri, 16 Nov 2007 21:28:46 -0800</pubDate>
		<dc:creator>Kadin2048</dc:creator>
	</item><item>
		<title>By: spacewrench</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136200</link>	
		<description>X display authorization is a dark and murky corner of my memory, but I believe your problem is that the person who started the X server is different from you when you log in via SSH.  The X server only lets the person who started it open new connections.  If you can get an X program executed before the normally-running application, you can do &quot;xhost +&quot; to accept connections from anybody.  Then, when the app crashes, you should be able to start it again by saying &quot;application -display :0&quot;.  (Note that you may have to use nohup(1) to keep the application from getting killed when you log out of ssh.)  Check out the xauth(1) man  page, too, for a better solution than letting anybody pop up new windows.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136200</guid>
		<pubDate>Fri, 16 Nov 2007 21:29:51 -0800</pubDate>
		<dc:creator>spacewrench</dc:creator>
	</item><item>
		<title>By: schof</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136201</link>	
		<description>X applications often have a -display or --display option as well. Also, the format you&apos;re wanting to use for the variable/option is more likely to be &quot;0:0&quot; than the other options you tried.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136201</guid>
		<pubDate>Fri, 16 Nov 2007 21:30:00 -0800</pubDate>
		<dc:creator>schof</dc:creator>
	</item><item>
		<title>By: wierdo</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136202</link>	
		<description>Umm..plain :0 should work, or at least it worked for years with XFree. Perhaps Xorg is different?&lt;br&gt;
&lt;br&gt;
What may be an issue is the program actually &lt;i&gt;connecting&lt;/i&gt; to the X server, which may require an xhost command.&lt;br&gt;
&lt;br&gt;
Oh, be sure you&apos;re doing &apos;&lt;i&gt;export&lt;/i&gt; DISPLAY=:0&apos;, otherwise the variable will remain local to the shell.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136202</guid>
		<pubDate>Fri, 16 Nov 2007 21:30:31 -0800</pubDate>
		<dc:creator>wierdo</dc:creator>
	</item><item>
		<title>By: Kadin2048</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136205</link>	
		<description>Clarification: here&apos;s what I&apos;m actually doing...&lt;br&gt;
&lt;br&gt;
&lt;code&gt;$ set DISPLAY=127.0.0.1:0.0&lt;br&gt;
$ xeyes&lt;br&gt;
Error: Can&apos;t open display: 0.0&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
Same for all variations of localhost, 127.0.0.1, 0, etc., and for displays 0 and 1 on each.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136205</guid>
		<pubDate>Fri, 16 Nov 2007 21:31:51 -0800</pubDate>
		<dc:creator>Kadin2048</dc:creator>
	</item><item>
		<title>By: Kadin2048</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136208</link>	
		<description>@wierdo: That seemed to produce something different.&lt;br&gt;
&lt;br&gt;
&lt;code&gt;$ export DISPLAY=:0 &lt;br&gt;
$ xeyes&lt;br&gt;
Xlib: connection to &quot;:0.0&quot; refused by server&lt;br&gt;
Xlib: No protocol specified&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
The connection refused message is different from what I&apos;ve been getting before, so that&apos;s progress at least.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136208</guid>
		<pubDate>Fri, 16 Nov 2007 21:33:49 -0800</pubDate>
		<dc:creator>Kadin2048</dc:creator>
	</item><item>
		<title>By: spacewrench</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136209</link>	
		<description>Many Linux distros don&apos;t turn on the TCP socket for X.  Therefore, &quot;[address]:0&quot; often doesn&apos;t work.  (Of course, if you can find the right config file, you could turn on TCP connections too.)  In any case, &quot;:0&quot; or &quot;:0.0&quot; should do the trick, except for the authorization weirdness I mentioned previously.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136209</guid>
		<pubDate>Fri, 16 Nov 2007 21:34:33 -0800</pubDate>
		<dc:creator>spacewrench</dc:creator>
	</item><item>
		<title>By: hattifattener</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136213</link>	
		<description>Just setting DISPLAY to &quot;:0.0&quot; (no hostname, display 0, screen 0 on that display) should do it in the common case...&lt;br&gt;
&lt;br&gt;
You might also not have permission to talk to the display (if, e.g., you&apos;re using xauth cookies and sshing in as a different user than the one on the display). You can fix that with &quot;xhost&quot;, say by authorizing all local users to use the display (&quot;xhost +localhost&quot;), or you can use xauth (which I&apos;ve forgotten how to use &#8212; check the man pages).&lt;br&gt;
&lt;br&gt;
(On preview: yeah.)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136213</guid>
		<pubDate>Fri, 16 Nov 2007 21:35:30 -0800</pubDate>
		<dc:creator>hattifattener</dc:creator>
	</item><item>
		<title>By: rfs</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136215</link>	
		<description>What does foo think its IP address is ? Normally you would set DISPLAY to foo:0.0</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136215</guid>
		<pubDate>Fri, 16 Nov 2007 21:45:16 -0800</pubDate>
		<dc:creator>rfs</dc:creator>
	</item><item>
		<title>By: Kadin2048</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136240</link>	
		<description>Got it working!&lt;br&gt;
&lt;br&gt;
What I had to do was edit the ~/.fluxbox/apps file for the user who starts the machine&apos;s initial X session, and add &lt;br&gt;
&lt;code&gt;[startup] {xhost +}&lt;/code&gt;&lt;br&gt;
at the top, before the other applications that start automatically.&lt;br&gt;
&lt;br&gt;
Then, I can SSH in later and restart the program I want displayed (after exporting DISPLAY=:0), and I don&apos;t get the &apos;refused by server&apos; error.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136240</guid>
		<pubDate>Fri, 16 Nov 2007 22:18:57 -0800</pubDate>
		<dc:creator>Kadin2048</dc:creator>
	</item><item>
		<title>By: zsazsa</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136242</link>	
		<description>2nd spacewrench and hattifattener. You must be the same user.&lt;br&gt;
&lt;br&gt;
If xauth vooodoo doesn&apos;t work, one other option would be to keep an instance of &lt;a href=&quot;http://www.karlrunge.com/x11vnc/&quot;&gt;x11vnc&lt;/a&gt; running - this will let you VNC into foo&apos;s real X display.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136242</guid>
		<pubDate>Fri, 16 Nov 2007 22:21:11 -0800</pubDate>
		<dc:creator>zsazsa</dc:creator>
	</item><item>
		<title>By: rdr</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136324</link>	
		<description>No. Xhost + is not a good idea. It allows anyone to run an application on the X server. I don&apos;t remember all that much about authentication in X but at the very least you can use xhost to limit access to particular users. You shouldn&apos;t stop there though. If you&apos;re going to do this, you should look at the manual page for xauth and whatever display manager the workstation is using.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136324</guid>
		<pubDate>Sat, 17 Nov 2007 02:48:58 -0800</pubDate>
		<dc:creator>rdr</dc:creator>
	</item><item>
		<title>By: TravellingDen</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136364</link>	
		<description>Second xhost+ being a bad idea unless TCP listening is turned off for the X server and there are no other local users.&lt;br&gt;
&lt;br&gt;
Among other things, the ability to attach to an X display also lets you capture all keyboard and mouse input without the original user knowing.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136364</guid>
		<pubDate>Sat, 17 Nov 2007 06:02:46 -0800</pubDate>
		<dc:creator>TravellingDen</dc:creator>
	</item><item>
		<title>By: zengargoyle</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136664</link>	
		<description>OMG, &apos;xhost -&apos; now!  &apos;xhost +&apos; is crazy &quot;root my box&quot; talk.&lt;br&gt;
&lt;br&gt;
&lt;code&gt;&lt;br&gt;
# as root, extract xauth info from user that started X&lt;br&gt;
$ XAUTHORITY=/home/usrname/.Xauthority xauth list&lt;br&gt;
hostname/unix:0  MIT-MAGIC-COOKIE-1  273bf22484148c6504f5d85e6ef510e5&lt;br&gt;
hostname.sub.domain:0  MIT-MAGIC-COOKIE-1  273bf22484148c6504f5d85e6ef510e5&lt;br&gt;
&lt;br&gt;
# as current user, add xauth info to your xauth info...&lt;br&gt;
$ xauth add hostname/unix:0  MIT-MAGIC-COOKIE-1  273bf22484148c6504f5d85e6ef510e5&lt;br&gt;
$ xauth add hostname.sub.domain:0  MIT-MAGIC-COOKIE-1  273bf22484148c6504f5d85e6ef510e5&lt;br&gt;
&lt;br&gt;
# set display variable and start application&lt;br&gt;
$ DISPLAY=hostname.sub.domain:0 /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
gah!, &apos;xhost +&apos; is like having a Windows box.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136664</guid>
		<pubDate>Sat, 17 Nov 2007 12:12:37 -0800</pubDate>
		<dc:creator>zengargoyle</dc:creator>
	</item><item>
		<title>By: zengargoyle</title>
		<link>http://ask.metafilter.com/76470/Remotely-starting-local-X-application#1136669</link>	
		<description>bah, code tags failed me...  export/import the xauth stuff and set DISPLAY appropriately and start your application with appropriate daemonization.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76470-1136669</guid>
		<pubDate>Sat, 17 Nov 2007 12:15:24 -0800</pubDate>
		<dc:creator>zengargoyle</dc:creator>
	</item>
	</channel>
</rss>
