<?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>No pain no gain &#187; FTP</title>
	<atom:link href="http://www.dikant.de/category/ftp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dikant.de</link>
	<description>Personal blog of Peter Dikant</description>
	<lastBuildDate>Sat, 28 Jan 2012 12:25:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Speeding up ProFTPD logins</title>
		<link>http://www.dikant.de/2011/08/16/speeding-up-proftpd-logins/</link>
		<comments>http://www.dikant.de/2011/08/16/speeding-up-proftpd-logins/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 18:21:25 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[FTP]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[proftpd]]></category>

		<guid isPermaLink="false">http://www.dikant.de/?p=220</guid>
		<description><![CDATA[One year ago I have switched from PureFTPd to ProFTPD because it runs smoother on the virtual server I am running. The server is really easy to setup and maintain, but with the standard configuration it always takes around 5 &#8230; <a href="http://www.dikant.de/2011/08/16/speeding-up-proftpd-logins/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.dikant.de/wp-content/uploads/2011/08/proftpd.png"><img src="http://www.dikant.de/wp-content/uploads/2011/08/proftpd-150x92.png" alt="" title="ProFTPD" width="150" height="92" class="alignleft size-thumbnail wp-image-221" /></a>One year ago I have switched from <a href="http://www.pureftpd.org" target="_blank">PureFTPd</a> to <a href="http://www.proftpd.org/" target="_blank">ProFTPD</a> because it runs smoother on the virtual server I am running. The server is really easy to setup and maintain, but with the standard configuration it always takes around 5 to 10 seconds to log on to the server. After searching for a solution to these slow logins, it turns out that there is even a point in the <a href="http://www.proftpd.org/docs/faq/linked/faq-ch4.html#AEN341" target="_blank">FAQ</a> on how to speed up the login process.</p>
<p>Just edit the file <code>/etc/proftpd/proftpd.conf</code> and add these 2 lines:</p>

<div class="wp_syntax"><div class="code"><pre class="config" style="font-family:monospace;">UseReverseDNS off
IdentLookups off</pre></div></div>

<p>Lesson learned: I should read manuals more often.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dikant.de/2011/08/16/speeding-up-proftpd-logins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up PureFTPD on a virtual server</title>
		<link>http://www.dikant.de/2009/01/22/setting-up-pureftpd-on-a-virtual-server/</link>
		<comments>http://www.dikant.de/2009/01/22/setting-up-pureftpd-on-a-virtual-server/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 19:21:46 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[FTP]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PureFTP]]></category>

		<guid isPermaLink="false">http://www.dikant.de/?p=56</guid>
		<description><![CDATA[PureFTPD is a secure and easy to configure FTP server. It has all the features you usually need, like TLS encryption, virtual users, quotas and limits. The only downside is that PureFTPD is not easy to install on a virtual &#8230; <a href="http://www.dikant.de/2009/01/22/setting-up-pureftpd-on-a-virtual-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.dikant.de/wp-content/uploads/2009/01/pure-ftpd.png" alt="PureFTPD Logo" title="PureFTPD Logo" width="224" height="64" class="alignleft size-full wp-image-55" /> <a href="http://www.pureftpd.org">PureFTPD</a> is a secure and easy to configure FTP server. It has all the features you usually need, like TLS encryption, virtual users, quotas and limits. The only downside is that PureFTPD is not easy to install on a virtual server because the default Debian package is compiled with some options that are not supported by the standard OpenVZ and Virtuozzo kernels. Therefore you need to recompile PureFTPD with some reasonable settings. In This post I will explain how to do that and do a basic service setup.</p>
<p><span id="more-56"></span></p>
<p>First you could try to install the default Debian package to check whether you need to recompile PureFTPD. This can be done via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> pure-ftpd-common pure-ftpd</pre></div></div>

<p>The following steps are needed to recompile the package with the necessary options to make it run on a virtual server. You only need to do these steps if you find the following message in your syslog when trying to connect to the ftp server:</p>

<div class="wp_syntax"><div class="code"><pre class="syslog" style="font-family:monospace;"> pure-ftpd: (?@?) [ERROR] Unable to switch capabilities : Operation not permitted</pre></div></div>

<p>In that case, make sure that you have enabled the Debian source repositories in your <code>/etc/apt/sources.list</code> and fetch the source files via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #7a0874; font-weight: bold;">source</span> pure-ftpd</pre></div></div>

<p>The source files have now been downloaded to your current directory. There should now some new files and a directory <code>pure-ftpd-1.0.21</code>. Enter this directory and edit the file <code>debian/rules</code> you should change the line starting with <code>optflags</code> and add <code>--without-capabilities</code> to that line, so that it looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="make" style="font-family:monospace;">optflags<span style="color: #004400;">=--</span>with<span style="color: #004400;">-</span>everything <span style="color: #004400;">--</span>with<span style="color: #004400;">-</span>largefile <span style="color: #004400;">--</span>with<span style="color: #004400;">-</span>pam <span style="color: #004400;">--</span>with<span style="color: #004400;">-</span>privsep <span style="color: #004400;">--</span>with<span style="color: #004400;">-</span>tls <span style="color: #004400;">--</span>without<span style="color: #004400;">-</span>capabilities</pre></div></div>

<p>Now grab the dependencies needed to build the source and compile the Debian installation package:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> build-dep pure-ftpd
dpkg-buildpackage <span style="color: #660033;">-uc</span> <span style="color: #660033;">-b</span></pre></div></div>

<p>The resulting Debian package should now have been built without errors and you can install it via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> ..<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd_1.0.1-<span style="color: #000000;">8</span>_i386.deb</pre></div></div>

<p>The filename of the package might vary depending on the current patch level in the Debian repository.</p>
<p>When installing the package you will be asked whether to use a chrooted setup which you should do and if you prefer a standalone installation or inetd-based operation. For low volume sites I would prefer the inetd installation.</p>
<p>Now let&#8217;s get on to the configuration of PureFTPD. I prefer a setup using virtual users which are mapped to a central user account on the server. So I usually create a new account without a shell or home directory which belongs to the Apache user group to have access to hosted webs:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">useradd <span style="color: #660033;">-g</span> www-data <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">false</span> ftpuser</pre></div></div>

<p>You can also use the existing user <code>www-data</code> instead. In that case you need to enable that user account (on Debian/Ubuntu it has the user id 33) in the PureFTP config:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000;">33</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>MinUID</pre></div></div>

<p>The configuration of PureFTP is done via distinct files in the directory <code>/etc/pure-ftpd/conf</code>. Each file contains a single configuration setting and we can setup a decent configuration with the following commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd<span style="color: #000000; font-weight: bold;">/</span>conf
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #000000; font-weight: bold;">&gt;</span> ChrootEveryone
<span style="color: #7a0874; font-weight: bold;">echo</span> no <span style="color: #000000; font-weight: bold;">&gt;</span> PAMAuthentication
<span style="color: #7a0874; font-weight: bold;">echo</span> no <span style="color: #000000; font-weight: bold;">&gt;</span> UnixAuthentication
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&gt;</span> TLS
<span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>auth
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> ..<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>PureDB 50pure</pre></div></div>

<p>With the above settings we disable all authentication methods except the internal PureFTPD user database. We also lock down each user into a chroot-environment and enable secure authentication via TLS. PureFTPD excepts a certificate in the file <code>/etc/ssl/private/pure-ftpd.pem</code>. You could copy your apache certificate to that file, or generate a new one via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-x509</span> <span style="color: #660033;">-days</span> <span style="color: #000000;">4312</span> <span style="color: #660033;">-nodes</span> <span style="color: #660033;">-keyout</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd.pem <span style="color: #660033;">-out</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd.pem</pre></div></div>

<p>The user administration and setup is now done with the PureFTPD tool <code>pure-pw</code>. You can add a new user via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pure-pw useradd myusername <span style="color: #660033;">-u</span> ftpuser <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>homedir</pre></div></div>

<p>The above command will ask you for a password and register the user which is mapped to the system user <code>ftpuser</code> within PureFTPD. Every time you modify the user database you need to rebuild the PureFTPD user configuration via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pure-pw mkdb</pre></div></div>

<p>Now you should be able to connect to your server with secure authorization with the newly created user.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dikant.de/2009/01/22/setting-up-pureftpd-on-a-virtual-server/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

