<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>jlogday.com &#187; howto</title>
	<atom:link href="http://blog.jlogday.com/tag/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jlogday.com</link>
	<description>programming, security, and other random thoughts</description>
	<lastBuildDate>Sun, 23 Aug 2009 22:16:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Starting a New X Server</title>
		<link>http://blog.jlogday.com/2009/02/starting-a-new-x-server/</link>
		<comments>http://blog.jlogday.com/2009/02/starting-a-new-x-server/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 03:10:43 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://blog.jlogday.com/?p=7</guid>
		<description><![CDATA[This is one of those posts that is mostly for me, so the next time I need to do this I don&#8217;t have to spend 30 minutes googling obscure config file formats. (Incidentally, I had to google and muck with styles for at least 30 minutes to figure out how to keep wordpress from mangling [...]]]></description>
			<content:encoded><![CDATA[<p>This is one of those posts that is mostly for me, so the next time I need to do this I don&#8217;t have to spend 30 minutes googling obscure config file formats. (Incidentally, I had to google and muck with styles for at least 30 minutes to figure out how to keep wordpress from mangling my code snippets.)</p>
<p>I sometimes find it useful to start an extra X server to run a particular application. Full-screen games are a good example. Ordinarily, a full-screen game grabs the display and there is no way to switch back to the desktop without exiting the game completely. When run in its own X server though, it is easy to switch between servers. The following shell script shows how to do this:</p>
<pre class="code">
#!/bin/bash

display=:1
authfile=$HOME/.Xauthority

if ! xauth list "$display" | grep "$display " &gt;/dev/null 2&gt;&amp;1; then
    xauth add $display . `mcookie`
    removelist="$display"
fi

xinit /usr/bin/xterm -- $display -auth $authfile -nolisten tcp

if [ -n "$removelist" ] ; then
    xauth remove $removelist
fi
</pre>
<p>This script will start a new X server on the next available virtual terminal (normally vt8) using display <code>:1</code> and launch an xterm. Toggle between the servers using <code>ctrl-alt-F7</code> and <code>ctrl-alt-F8</code>. When the xterm exits, so does the X server.</p>
<p>If you try to run this code on a Debian-based system, though, you will get the following error:</p>
<pre class="code">
X: user not authorized to run the X server, aborting.
xinit:  Server error.
</pre>
<p>I found this out the hard way when I started using <a href="http://www.ubuntu.com/">ubuntu</a>. This is because Debian uses a wrapper to start the X server, which enforces tighter security constraints by default. To get this to work, you will need to edit the <code>/etc/X11/Xwrapper.config</code> file, and change this line:</p>
<pre class="code">allowed_users=console</pre>
<p>to this:</p>
<pre class="code">allowed_users=anybody</pre>
<p>Check the man page for <code>Xwrapper.config</code> for more options; there aren&#8217;t very many. Personally, I don&#8217;t consider this a security risk for a single-user home system.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jlogday.com/2009/02/starting-a-new-x-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

