<?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>Debian Tutorials &#187; pure-ftpd</title>
	<atom:link href="http://www.debiantutorials.com/tag/pure-ftpd/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.debiantutorials.com</link>
	<description>Copy/Paste tutorials for Debian based Linux distros</description>
	<lastBuildDate>Tue, 27 Dec 2011 01:15:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Pure-FTPd with MySQL backend</title>
		<link>http://www.debiantutorials.com/pure-ftpd-with-mysql-backend/</link>
		<comments>http://www.debiantutorials.com/pure-ftpd-with-mysql-backend/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 21:43:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[pure-ftpd]]></category>

		<guid isPermaLink="false">http://debiantutorials.net/pure-ftpd-with-mysql-backend/</guid>
		<description><![CDATA[Pure-FTPd is a free, secure, production-quality and standard-conformant FTP server. It doesn't provide useless bells and whistles, but focuses on efficiency and ease of use. It provides simple answers to common needs, plus unique useful features for personal users as well as hosting providers. In this tutorial we'll install Pure-FTPd with MySQL backend. Install Pure-FTPd [...]]]></description>
			<content:encoded><![CDATA[<p>Pure-FTPd is a free, secure, production-quality and standard-conformant FTP server. It doesn't provide useless bells and whistles, but focuses on efficiency and ease of use. It provides simple answers to common needs, plus unique useful features for personal users as well as hosting providers.</p>
<p>In this tutorial we'll install Pure-FTPd with MySQL backend.</p>
<p>Install Pure-FTPd with mysql backend<br />
<code>apt-get install pure-ftpd-mysql<br />
</code><span id="more-7"></span></p>
<p>Create user and group used to run the ftp server<br />
<code>groupadd -g 2001 ftpgroup<br />
useradd -u 2001 -s /bin/false -d /bin/null -c "pureftpd user" -g ftpgroup ftpuser<br />
</code></p>
<p>Create database and a table that will store user information<br />
<code>mysql -u root -p<br />
GRANT SELECT ON ftpd.* TO vhosts@localhost IDENTIFIED BY 'mypasswd';<br />
FLUSH PRIVILEGES;<br />
CREATE DATABASE ftpd;<br />
USE ftpd;<br />
 &nbsp;<br />
CREATE TABLE users (<br />
user varchar(30) NOT NULL,<br />
password varchar(64) NOT NULL,<br />
home varchar(128) NOT NULL,<br />
bandwidth_limit_upload smallint(5) NOT NULL default 0,<br />
bandwidth_limit_download smallint(5) NOT NULL default 0,<br />
ip_allow varchar(15) NOT NULL default 'any',<br />
quota smallint(5) NOT NULL default '0',<br />
quota_files int(11) NOT NULL default 0,<br />
active enum('yes','no') NOT NULL default 'yes',<br />
PRIMARY KEY (user),<br />
UNIQUE KEY User (user)<br />
) TYPE=MyISAM;<br />
 &nbsp;<br />
INSERT INTO users (user, password, home) VALUES ('username', MD5('mypasswd'), '/home/username');<br />
 &nbsp;<br />
quit;<br />
</code></p>
<p>You will be able to control bandwidth limits and quotas for each user. Using zero for these fields will allow unlimited use of resources. The bandwidth limits are specified in KB/s and the quota in MB.</p>
<p>Configure Pure-ftpd (pico /etc/pure-ftpd/db/mysql.conf). Remove everything from the default configuration file and add these lines:<br />
<code>MYSQLSocket /var/run/mysqld/mysqld.sock<br />
MYSQLUser vhosts<br />
MYSQLPassword mypasswd<br />
MYSQLDatabase ftpd<br />
MYSQLCrypt md5<br />
MYSQLDefaultUID 2001<br />
MYSQLDefaultGID 2001<br />
MYSQLGetPW SELECT password FROM users WHERE user = "\L" AND active = "yes" AND (ip_allow = "any" OR ip_allow LIKE "\R")<br />
MYSQLGetDir SELECT home FROM users WHERE user = "\L"AND active = "yes" AND (ip_allow = "any" OR ip_allow LIKE "\R")<br />
MySQLGetBandwidthUL SELECT bandwidth_limit_upload FROM users WHERE user = "\L"AND active = "yes" AND (ip_allow = "any" OR ip_allow LIKE "\R")<br />
MySQLGetBandwidthDL SELECT bandwidth_limit_download FROM users WHERE user = "\L"AND active = "yes" AND (ip_allow = "any" OR ip_allow LIKE "\R")<br />
MySQLGetQTASZ SELECT quota FROM users WHERE user = "\L"AND active = "yes" AND (ip_allow = "any" OR ip_allow LIKE "\R")<br />
MySQLGetQTAFS SELECT quota_files FROM users WHERE user = "\L"AND active = "yes" AND (ip_allow = "any" OR ip_allow LIKE "\R")<br />
</code></p>
<p>Create these simple text files that will force the server to create home directories for users if they don't exist and chroot the user to it's home directory:</p>
<p>pico /etc/pure-ftpd/conf/ChrootEveryone<br />
<code>yes<br />
</code></p>
<p>pico /etc/pure-ftpd/conf/CreateHomeDir<br />
<code>yes<br />
</code></p>
<p>Since we are using pure-ftpd-mysql insted of pure-ftpd, make the following change (pico /usr/sbin/pure-ftpd-wrapper):<br />
<code>my $daemon = '/usr/sbin/pure-ftpd-mysql';<br />
</code></p>
<p>Restart Pure-ftpd<br />
<code>/etc/init.d/pure-ftpd-mysql restart<br />
</code></p>
<p>We're all done. You should be able to make connections to the servers with your favorite FTP client.</p>
<p>--</p>
<p><strong>Update - 29th October 2008</strong></p>
<p>I've had problems with debian-minimal installations where the ftp server simply won't start and doesn't leave any trace in the log files. To fix that I had to make one minor change to the inetd config file (pico /etc/inetd.conf):</p>
<p><code>ftp     stream  tcp     nowait  root    /usr/sbin/tcpd /usr/sbin/pure-ftpd-mysql<br />
</code></p>
<p>Open the config file and in the ftp line, change <strong>pure-ftpd-wrapper</strong> to <strong>pure-ftpd-mysql</strong></p>
<p>When done, restart inetd:</p>
<p><code>/etc/init.d/openbsd-inetd restart<br />
</code></p>
<p>--</p>
<p><strong>Update - 20th April 2010</strong></p>
<p>In lenny, use this command to restart the service or change the variable STANDALONE_OR_INETD to standalone in /etc/default/pure-ftpd-common:</p>
<p><code>/etc/init.d/openbsd-inetd restart<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.debiantutorials.com/pure-ftpd-with-mysql-backend/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
