<?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>Felipe Alfaro Solana &#187; NX</title>
	<atom:link href="http://www.felipe-alfaro.org/blog/category/nx/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.felipe-alfaro.org/blog</link>
	<description>A little bit of technology, security and networking with Linux, FreeBSD and Mac OS X, plus some personal opinions.</description>
	<lastBuildDate>Sun, 23 Oct 2011 16:46:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>FreeNX, usermode authentication and Mac OS X</title>
		<link>http://www.felipe-alfaro.org/blog/2009/01/18/freenx-usermode-authentication-and-mac-os-x/</link>
		<comments>http://www.felipe-alfaro.org/blog/2009/01/18/freenx-usermode-authentication-and-mac-os-x/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 13:43:03 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[NX]]></category>

		<guid isPermaLink="false">http://www.felipe-alfaro.org/blog/?p=264</guid>
		<description><![CDATA[I&#8217;ve always been looking for a way in NX/FreeNX to be able to authenticate using mechanisms other than username and password, like SSH private/public keys or Kerberos. Turns out that it is possible Someone pointed me to the FreeNX 0.7.3 announcement that contains the following excerpt: Usermode and SUID Wrapper ================== We are now very [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always been looking for a way in NX/FreeNX to be able to authenticate using mechanisms other than username and password, like SSH private/public keys or Kerberos. Turns out that it is possible <img src='http://www.felipe-alfaro.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Someone pointed me to the <a href="http://mail.kde.org/pipermail/freenx-knx/2008-August/007324.html">FreeNX 0.7.3 announcement</a> that contains the following excerpt:</p>
<blockquote><p><code><br />
Usermode and SUID Wrapper<br />
==================</p>
<p>We are now very close to login directly with users and I also heard of a C program, which can be seamlessly put between nxclient and nxssh. So with client support we now have three alternatives:</p>
<p>1. Login as user via ssh and connect to server with ssh command on server again.<br />
2. Login as user and use usermode to save all sessions locally for each user.<br />
3. Use a SUID nx (not root!) wrapper to startup a new "trusted" session.</p>
<p>One is error prone, two is good, but looses the central structure, three is best of both worlds and with being suid nx also has the most advantages, however not the dreaded public key problems.</p>
<p>_Yes_, this means if you use the suid wrapper, you still need the nx user, but you can remove the public keys and it'll still work.</p>
<p>The SUID wrapper is a part from the work of the redesign and thanks goes to Alistair Riddoch from Google here.<br />
</code></p></blockquote>
<p>By default, NoMachine&#8217;s NX nxserver requires nxclient to login via SSH into the remote machine as user <code>nx</code>. As <code>nxserver</code> is defined as the login shell, it is run by the <code>sshd</code> daemon. From there on, there is a dialogue between nxclient and nxserver where nxclient supplies the user credentials (username and password that were specified in the nxclient configuration). There is, in fact, a second authentication that is performed via another SSH session to 127.0.0.1 using nxclient&#8217;s supplied credentials. If this second authentication succeeds, the NX session is activated and accessible from the NX client.</p>
<p>This works well for remote servers that are shared by multiple users, as the <code>nx</code> user and its centralized approach makes it very easy to see how many sessions are currently running (or suspended), terminate them, etc. However, for machines that are not shared by multiple users, or in those cases where authentication mechanisms other than username and password are required, this model does not work very well.</p>
<p>This is where FreeNX&#8217;s usermode enters the scene. Basically, what it means, is that authentication to nxserver does no longer happen as the <code>nx</code> user but as the end-user himself. Now, the number of SSH sessions is reduced to one that authenticates the user directly by means of SSH&#8217;s built-in authentication capabilities, and where nxserver is run under the end-user credentials instead of the <code>nx</code> user. This, obviously, kills the centralized approach originally envisioned by NoMachine, since now all the control and session files can&#8217;t be stored easily and securely in a central location but are now stored in the user&#8217;s home directory. But I think the upsides of the usermode support outdo the lack of centralized management. At least in my case, I don&#8217;t need centralized management since it&#8217;s me who manages all my boxes and logs into them.</p>
<h2>How to install and configure FreeNX to support usermode</h2>
<p>Next I describe what I had to do, both on the remote machine and also on the client, to get a working FreeNX environment that supports usermode. Other modes are also supported, like legacy nx-based, SUID and others.</p>
<h3>Download NX4U tarball from BerliOS and extract it</h3>
<div>
<pre>
$ wget http://download.berlios.de/freenx/NX4U.tar.gz
$ sudo tar -C /opt -zxf NX4U.tar.gz
</pre>
</div>
<p><em>NOTE</em>: The NX4U tarball that I used can also be downloaded from this Web site <a href="http://www.felipe-alfaro.org/blog/wp-content/NX/NX4U.tar.gz">here</a>.</p>
<p><em>NOTE</em>: The NX4U set and the nxssh wrapper are smart enough so that you can also extract the NX4U tarball in other locations. Looking at the source code for the nxssh wrapper &#8212; <code>nxssh-4US.c</code> &#8212; nxssh wrapper uses the following PATH to locate the nxserver binary:</p>
<pre>
#define NXSERVER_PATH \
"~/bin:
~/NX4U/:
/usr/NX/bin:
/opt/NX/bin:
/opt/NX4U/bin:
/usr/NX4U/bin:
/usr/local/NX4U/bin:
/usr/lib/nx/bin"
</pre>
<h3>Compile the nxssh wrapper</h3>
<p>First, download the source code from the SVN repository:</p>
<div>
<pre>
$ svn checkout https://developername@svn.berlios.de/svnroot/repos/freenx/trunk
</pre>
</div>
<p>NOTE: I saved a copy of the SVN repository that I used. The tarball is available in this Web site <a href="http://www.felipe-alfaro.org/blog/wp-content/NX/freenx-trunk.tar.bz2">here</a>.<br />
Build the nxssh wrapper for Mac OS X. nxssh is a simple C program that currently compiles for me with no problems on Linux and Mac OS X:</p>
<div>
<pre>
$ cd trunk/freenx-utils/nxpublickey/
$ make nxssh
</pre>
</div>
<p>NOTE: The Makefile also has a target named nxssh.exe to compile the wrapper for Windows.</p>
<p>Now, let&#8217;s rename NoMachine&#8217;s nxssh binary to mxssh (the nxssh wrapper expects NoMachine&#8217;s nxssh binary to be renamed to mxssh), then install the nxssh wrapper:</p>
<div>
<pre>
$ sudo bash
# mv /usr/NX/bin/nxssh /usr/NX/bin/mxssh
# install -m755 nxssh /usr/NX/bin/nxssh
# ^D
</pre>
</div>
<h3>Configure <code>.ssh/config</code></h3>
<p>What looks like a bug in NoMachine&#8217;s nxssh, will cause authentication requests using public key to fail with a <code>"percent_expand: NULL replacement"</code> error unless <code>.ssh/config</code> is modified to explicitly state the location of the public key. For example:</p>
<div>
<pre>
Host my.host.org
        IdentityFile ~/.ssh/id_dsa
</pre>
</div>
<h3>Configure nxclient</h3>
<p>In order to use usermode authentication, make sure to prepend the hostname with the @ (at) sign:</p>
<p><code>Hostname: @my.host.org</code></p>
<p>Also, make sure the username has the @ (at) sign prepended plus @U (at U) appended. These non-standard forms are parsed by the nxssh wrapper and enable usermode authentication (or other authentications like SUID):</p>
<p><code>Username: @myself@U</code></p>
<p>For more information about possible syntaxes, take a look at <code>freenx-utils/nxpublickey/nxssh-wrapper</code> (the shell script implementation of the <code>nxssh</code> wrapper).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2009/01/18/freenx-usermode-authentication-and-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Installing FreeNX 0.7.1 on Ubuntu</title>
		<link>http://www.felipe-alfaro.org/blog/2007/11/24/installing-freenx-071-on-ubuntu/</link>
		<comments>http://www.felipe-alfaro.org/blog/2007/11/24/installing-freenx-071-on-ubuntu/#comments</comments>
		<pubDate>Sat, 24 Nov 2007 12:27:20 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[NX]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2007/11/24/installing-freenx-071-on-ubuntu/</guid>
		<description><![CDATA[Introduction DISCLAIMER: The contents of this post are mostly based on Manual Installation How-To. Thanks to Brent Davidson and Fabian Franz for writing such a nice HowTo and the beautiful open and free implementation of FreeNX, respectively. I decided to use FreeNX instead of NoMachine&#8217;s own implementation due to the instability of the latter. Most [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p><strong>DISCLAIMER</strong>: The contents of this post are mostly based on <a href="http://www.nabble.com/Manual-Installation-How-To-t4726723.html">Manual Installation How-To</a>. Thanks to Brent Davidson and Fabian Franz for writing such a nice HowTo and the beautiful open and free implementation of FreeNX, respectively.</p>
<p>I decided to use FreeNX instead of NoMachine&#8217;s own implementation due to the instability of the latter. Most of the times, I could not reconnect to my running sessions, or else NX decided to kill my running session and start a new one. FreeNX is a collection of shell scripts, which makes it easier to debug and troubleshoot problems.</p>
<p>The process described in this post starts with the NoMachine&#8217;s binary components, downloadable from the Web, and then overwrites or replaces key components that are binary-only and closed with FreeNX&#8217;s open and free shell scripts, which provides much more flexibility. In my own experience, FreeNX is more robust, stable, predictable, easier to customize and to debug than NoMachine&#8217;s closed binary components.</p>
<h2>Installing the base NoMachine&#8217;s NX binary components</h2>
<p>Download <code>nxclient</code>, <code>nxnode</code> and <code>nxserver</code> from <a href="http://www.nomachine.com/select-package.php?os=linux&#038;id=1">NoMachine</a> as <code>.tar.gz</code> files. The files can be found in the <a href="http://www.nomachine.com/select-package.php?os=linux&#038;id=1">NoMachine downloads</a> or can be downloaded directly from this site, if you trust me:</p>
<p>For IA-32 systems:</p>
<ul>
<li><a href="/blog/wp-content/NX/nxclient-3.0.0-84.i386.tar.gz">nxclient-3.0.0-84.i386.tar.gz</a></li>
<li><a href="/blog/wp-content/NX/nxnode-3.0.0-93.i386.tar.gz">nxnode-3.0.0-93.i386.tar.gz</a></li>
<li><a href="/blog/wp-content/NX/nxserver-3.0.0-79.i386.tar.gz">nxserver-3.0.0-79.i386.tar.gz</a></li>
</ul>
<p>For x86_64 systems:</p>
<ul>
<li><a href="/blog/wp-content/NX/nxclient-3.0.0-84.x86_64.tar.gz">nxclient-3.0.0-84.x86_64.tar.gz</a></li>
<li><a href="/blog/wp-content/NX/nxnode-3.0.0-93.x86_64.tar.gz">nxnode-3.0.0-93.x86_64.tar.gz</a></li>
<li><a href="/blog/wp-content/NX/nxserver-3.0.0-79.x86_64.tar.gz">nxserver-3.0.0-79.x86_64.tar.gz</a></li>
</ul>
<p>Extract the files to <code>/usr</code>. Since the <code>.tar.gz</code> packages always contain relative pathnames that start with <code>./NX</code>, this will create a whole directory tree under <code>/usr/NX</code>.</p>
<div>
<pre>
# tar -C /usr –xzf nxserver-3.0.0-79.i386.tar.gz
# tar -C /usr –xzf nxclient-3.0.0-84.i386.tar.gz
# tar -C /usr –xzf nxnode-3.0.0-93.i386.tar.gz
</pre>
</div>
<h2>Compiling the NX compression libraries</h2>
<h3>Compiling <code>nxcomp</code></h3>
<p>Download the source code for <code>nxcomp</code> from <a href="http://www.nomachine.com/sources.php">NoMachine&#8217;s source code</a> or here from<br />
<a href="/blog/wp-content/NX/nxcomp-3.0.0-48.tar.gz">nxcomp-3.0.0-48.tar.gz</a>.</p>
<p>The <code>./configure</code> is not very robust and doesn&#8217;t check for missing dependencies. This are the packages that are needed to compile <code>nxcomp</code>:</p>
<div>
<pre>
# apt-get install zlib1g-dev libX11-dev libjpeg-dev libpng12-dev \
    x11proto-xext-dev libxdamage-dev libxrandr-dev libxtst-dev \
    libaudiofile-dev
</pre>
</div>
<p>Configuring, building the library and copying it to its final location is just as easy as running:</p>
<div>
<pre>
# tar -xzf nxcomp-3.0.0-48.tar.gz
# cd nxcomp
# ./configure --prefix=/usr/NX
# make
# cp -P libXcomp.so* /usr/NX/lib
</pre>
</div>
<h3>Compiling <code>nxcompext</code></h3>
<p>Download the source code for <code>nxcompext</code> and <code>nx-X11</code> from <a href="http://www.nomachine.com/sources.php">NoMachine&#8217;s source code</a> or here from<br />
<a href="/blog/wp-content/NX/nxcompext-3.0.0-18.tar.gz">nxcompext-3.0.0-18.tar.gz</a> and <a href="/blog/wp-content/NX/nx-X11-3.0.0-37.tar.gz">nx-X11-3.0.0-37.tar.gz</a>, and extract them:</p>
<div>
<pre>
# tar -xzf nxcompext-3.0.0-18.tar.gz
# tar -xzf nx-X11-3.0.0-37.tar.gz
</pre>
</div>
<p>Before compiling <code>nxcompext</code>, apply the <a href="/blog/wp-content/NX/NXlib-xgetioerror.patch">NXlib-xgetioerror.patch</a>.</p>
<div>
<pre>
# cd nxcompext
# patch -p0 < NXlib-xgetioerror.patch
</pre>
</pre>
</div>
<p>This is required or else the resulting <code>libXcomp.so</code> shared library will complain about <code>_XGetIOError</code> symbol being undefined. In order to troubleshoot this, I had to enable logging in <code>/usr/NX/etc/node.conf</code>:</p>
<div>
<pre>
NX_LOG_LEVEL=7
SESSION_LOG_CLEAN=0
NX_LOG_SECURE=0
</pre>
</div>
<p>Then, looking at <code>/var/log/nxserver.log</code> I found the following error message:</p>
<pre>
Info: Established X client connection.
Info: Using shared memory parameters 1/1/1/4096K.
Info: Using alpha channel in render extension.
Info: Not using local device configuration changes.
/usr/NX/bin/nxagent: symbol lookup error: /usr/NX/lib/libXcompext.so.3:
undefined symbol: _XGetIOError
NX> 1006 Session status: closed
</pre>
<p>Applying the patch solves the problem:</p>
<div>
<pre>
# ./configure --x-includes="/usr/include/xorg -I/usr/include/X11" --prefix=/usr/NX
# make
# cp -P libXcompext.so* /usr/NX/lib
</pre>
</div>
<h3>Compiling <code>nxcompshad</code></h3>
<p>Download the source code for <code>nxcompshad</code> from <a href="http://www.nomachine.com/sources.php">NoMachine&#8217;s source code</a> or here from<br />
<a href="/blog/wp-content/NX/nxcompshad-3.0.0-19.tar.gz">nxcompshad-3.0.0-19.tar.gz</a>.</p>
<div>
<pre>
# tar -xzf nxcompshad-3.0.0-19.tar.gz
# cd nxcompshad
# ./configure --prefix=/usr/NX
# make
# cp -P libXcompshad.so* /usr/NX/lib
</pre>
</div>
<h3>Compiling <code>nxesd</code></h3>
<p>Download the source code for <code>nxesd</code> from <a href="http://www.nomachine.com/sources.php">NoMachine&#8217;s source code</a> or here from<br />
<a href="/blog/wp-content/NX/nxesd-3.0.0-4.tar.gz">nxesd-3.0.0-4.tar.gz</a>.</p>
<div>
<pre>
# tar -xzf nxesd-3.0.0-4.tar.gz
# cd nxesd
# ./configure --prefix=/usr/NX
# make
# make install
</pre>
</div>
<h2>Installing FreeNX</h2>
<p>Download <a href="http://freenx.berlios.de/">FreeNX</a> from <a href="http://freenx.berlios.de/download.php">FreeNX downloads</a>, or from this Web site at <a href="/blog/wp-content/NX/freenx-0.7.1.tar.gz">freenx-0.7.1.tar.gz</a> and extract them and apply the <code>gentoo-machine.diff</code> patch:</p>
<div>
<pre>
# tar -xzf freenx-X.Y.Z.tar.gz
# cd freenx-X.Y.Z
# patch -p0 < gentoo-nomachine.diff
</pre>
</pre>
</div>
<p>The <code>gentoo-machine.diff</code> patch must be applied if you are using the <code>/usr/NX</code> directory structure that the NoMachine libraries use.</p>
<p>Next, we replace the original NoMachine key binaries (in fact, they are compiled Perl scripts) with the FreeNX shell scripts:</p>
<div>
<pre>
# cp -f nxkeygen /usr/NX/bin/
# cp -f nxloadconfig /usr/NX/bin/
# cp -f nxnode /usr/NX/bin/
# cp -f nxnode-login /usr/NX/bin/
# cp -f nxserver /usr/NX/bin/
# cp -f nxsetup /usr/NX/bin/
# cp -f nxcups-gethost /usr/NX/bin/
</pre>
</div>
<p>Next, we need to compile the <code>nxserver-helper</code> binary, which is used by the slave mode of <code>nxnode</code>. Basically, <code>nxserver-helper</code> runs a command that has both <code>/dev/fd/3</code> and <code>/dev/fd/4</code> mapped into both ends of a UNIX SOCKET.</p>
<div>
<pre>
# cd nxserver-helper
# make
# cp -f nxserver-helper /usr/NX/bin/
</pre>
</div>
<p>Before being able to set up the FreeNX, install <code>expect</code>, the OpenSSH server and <code>smbmount</code> and <code>smbumount</code>:</p>
<div>
<pre>
$ sudo apt-get install expect smbfs openssh-server
</pre>
</div>
<p>The next step creates symbolic links in <code>/usr/bin</code> to all FreeNX scripts that live in <code>/usr/NX/bin</code> and additional symbolic links for NX compatibility:</p>
<div>
<pre>
# ln -s /usr/NX/bin/nxserver /usr/bin/nxserver
# ln -s /usr/NX/bin/nxsetup /usr/sbin/nxsetup
# ln -s /usr/NX/bin/nxloadconfig /usr/sbin/nxloadconfig
# ln -s /usr/NX/lib/libXrender.so.1.2.2 /usr/NX/lib/libXrender.so.1.2
# ln -s /usr/NX/bin/nxagent /usr/NX/bin/nxdesktop
# ln -s /usr/NX/bin/nxagent /usr/NX/bin/nxviewer
# ln -s /usr/bin/foomatic-ppdfile /usr/lib/cups/driver/foomatic-ppdfile
# ln -s /etc/X11/xinit /etc/X11/xdm
# ln -s /sbin/mount.cifs /sbin/smbmount
# ln -s /sbin/umount.cifs /sbin/smbumount
</pre>
</div>
<p>The final step consists is running the installation stage of FreeNX:</p>
<div>
<pre>
# nxsetup --install
</pre>
</div>
<p>This will create <code>/usr/NX/var</code> directory tree, create the <code>nx</code> user, install the appropiate SSH keys (either the NoMachine&#8217;s keys or custom keys).</p>
<p>Before being able to use FreeNX, create the <code>node.conf</code> configuration file that allow changing the behavior of FreeNX, like logging, path names to several scripts used to start GNOME or KDE, and so on:</p>
<div>
<pre>
# cd freenx-X.Y.Z
# cp node.conf.sample /usr/NX/etc/node.conf
</pre>
</div>
<h2>Future development and ideas</h2>
<ul>
<li>Not having to depend on any single binary file from NoMachine.
<p>The idea is compiling all the components from source code, instead of starting with a binary distribution and replacing key components with their open and free counterparts.</li>
<li>Customizing FreeNX so that I can bypass NoMachine&#8217;s <code>nxclient</code> completely.
<p>Most of my network components are Kerberized and having to keep supplying my password to <code>nxclient</code> seems like a thing of the past to me. The idea is customizing FreeNX in such a way that I can leverage Kerberos authentication and drop password-based authentication completely.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2007/11/24/installing-freenx-071-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>FreeNX on Linux</title>
		<link>http://www.felipe-alfaro.org/blog/2005/08/17/freenx-on-linux/</link>
		<comments>http://www.felipe-alfaro.org/blog/2005/08/17/freenx-on-linux/#comments</comments>
		<pubDate>Tue, 16 Aug 2005 22:34:26 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[NX]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2005/08/17/freenx-on-linux/</guid>
		<description><![CDATA[FreeNX is based on NoMachine.com NX compression GPL components to allow a fast, graphical remote desktop terminal session for UNIX-based systems. NX uses SSH tunneling to perform authentication and link parameters negotiation. NoMachine.com has NX viewer clients for Mac OS X and Linux. By default, the nxclient software uses a built-in private key to allow [...]]]></description>
			<content:encoded><![CDATA[<p>FreeNX is based on NoMachine.com NX compression GPL components to allow a fast, graphical remote desktop terminal session for UNIX-based systems. NX uses SSH tunneling to perform authentication and link parameters negotiation.</p>
<p>NoMachine.com has NX viewer clients for Mac OS X and Linux. By default, the nxclient software uses a built-in private key to allow connecting to the remote NX server via SSH DSA public key. When using FreeNX, it&#8217;s recommeded to generate a new private-public DSA key pair and iinstall them onto the client machines and the remote NX servers.</p>
<p>The NX server software uses the &#8220;nx&#8221; user account, configured to allow for public key authentication, which is then used to start up the remote agent and proxy components used by the NX protocol. The NX client starts a remote SSH session against the NX server using this &#8220;nx&#8221; user. Thus, we need to manually generate a DSA pair key. The private DSA key will get installed into the client, while the public key will get installed into the NX server.</p>
<p>FreeNX can be obtained from the following sites:</p>
<p><b>For Fedora Core:</b></p>
<p>http://fedoranews.org/contributors/rick_stout/freenx/freenx-0.2.7-0.fdr.1.noarch.rpm</p>
<p>http://fedoranews.org/contributors/rick_stout/freenx/nx-1.4.0-0.fdr.3.i386.rpm</p>
<p><b>For Debian:</b><br />
By adding the following to &#8220;/etc/apt/sources.list&#8221;:</p>
<p><code>deb http://kanotix.com/files/debian/ ./</code></p>
<p>the running</p>
<p><code># apt-get install freenx</code></p>
<ol>
<li>
<h4>Generating the DSA private-public key pair.</h4>
<p>We must use the &#8220;ssh-keygen&#8221; command line tool to create a private-public key pair. For example, by issuing the following command on the client machine:</p>
<p><code># ssh-keygen -t dsa<br />
Generating public/private dsa key pair.<br />
Enter file in which to save the key (/Users/falfaro/.ssh/id_dsa): <enter><br />
Enter passphrase (empty for no passphrase): </enter><enter><br />
Enter same passphrase again: </enter><enter><br />
Your identification has been saved in /Users/falfaro/.ssh/id_dsa.<br />
Your public key has been saved in p.pub.<br />
The key fingerprint is:<br />
76:f1:09:07:f3:ef:4d:0a:a9:b7:ac:48:49:93:67:fe falfaro@mac.local</enter></code></p>
<p>The private key should <b>NOT</b> be protected by a passphrase, as it will be directly used by the NX client software before any authentication is performed.</li>
<li>
<h4>Installing the private key into the NX client software</h4>
<p>The next step is replacing the NX client software built-in private key with the one we have just created. NoMachine&#8217;s NX client software stores the DSA private key in &#8220;/usr/NX/share/client.id_dsa.key&#8221;:</p>
<p><code># ls -l /usr/NX/share/client.id_dsa.key<br />
-rw-r--r-- 1 root wheel 668 27 Dec 13:59 /usr/NX/share/client.id_dsa.key</code></p>
<p>Thus, we should execute the following command:</p>
<p><code># mv /usr/NX/share/client.id_dsa.key /usr/NX/share/client.id_dsa.key.OLD<br />
# mv /Users/falfaro/.ssh/id_sa /usr/NX/share/client.id_dsa.key<br />
# chown root:wheel /usr/NX/share/client.id_dsa.key<br />
# chmod 644 /usr/NX/share/client.id_dsa.key</code></li>
<li>
<h4>Installing the public key into the NX server software</h4>
<p>The last step is installing the public key, which corresponds to the &#8220;nx&#8221; user, into remote server. The public key will be installed as an &#8220;authorized_keys2&#8243; file inside the home directory for the &#8220;nx&#8221; user. The OpenSSH service will use this file to store the &#8220;nx&#8221; user public key the NX client software uses to authenticate against the NX server.</p>
<p>Depending on the distribution and FreeNX implementation, the home directory for the &#8220;nx&#8221; user will be located in different places. In Fedora Core, this is usually &#8220;/var/lib/nxserver/nxhome&#8221;. In Debian, this is usually &#8220;/home/.nx&#8221;.</p>
<p>The last step is distributing the &#8220;id_dsa.pub&#8221; file to the remote NX server machine and authorize it:</p>
<p><code># scp /Users/falfaro/.ssh/id_dsa.pub root@NXSERVER:<br />
# rm /Users/falfaro/.ssh/id_dsa.pub<br />
# ssh root@NXSERVER<br />
# mv /root/id_dsa.pub /home/.nx/.ssh/authorized_keys2<br />
# chown nx:root /home/.nx/.ssh/authorized_keys2<br />
# chmod 600 /home/.nx/.ssh/authorized_keys2</code></li>
<li>
<h4>Testing public key authentication</h4>
<p>Before using the NX client software to connect to the remote NX server, it&#8217;s recommended to check whether we can connect remotely to the NX server using an SSH client using public key authentication for the &#8220;nx&#8221; user:</p>
<p><code># ssh -i /usr/NX/share/client.id_dsa.key nx@NXSERVER<br />
Linux NXSERVER 2.6.10 #1 Sat Dec 25 05:20:24 CET 2004 i686 GNU/Linux<br />
...<br />
HELLO NXSERVER - Version 1.4.0-02 OS_(GPL)<br />
NX> 105 quit<br />
quit<br />
Quit<br />
NX> 999 Bye<br />
Connection to ubuntu closed.</code></p>
<p>If this works, we can be pretty sure the NX client will allow us to establish a remote session against the NX server.</li>
<li>
<h4>Configuring FreeNX server to support resuming of suspended sessions</h4>
<p>In file &#8220;/usr/bin/nxserver&#8221;:</p>
<p>Replace the line that reads:</p>
<p><code>ENABLE_AUTORECONNECT="0"</code></p>
<p>with</p>
<p><code>ENABLE_AUTORECONNECT="1"</code></p>
<p>Replace the line that reads:</p>
<p><code>session_list_user_suspended "$USER" 'Suspended' "$(getparam geometry)" "$(getparam type)" | log_tee</code></p>
<p>with</p>
<p><code>session_list_user_suspended "$USER" 'Suspended$|^status=Running$' "$(getparam geometry)" "$(getparam type)" | log_tee</code></p>
<p>This is very important as sometimes, when the NX client is disconnected from the NX server, the session is not marked as suspended.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2005/08/17/freenx-on-linux/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

