<?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>Blog dot Melimato dot Com &#187; ftp</title>
	<atom:link href="http://blog.melimato.com/category/server/ftp-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.melimato.com</link>
	<description>Those things we do</description>
	<lastBuildDate>Thu, 24 Dec 2009 11:58:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>PureFTP + MySQL with pure-uploadscript functionallity</title>
		<link>http://blog.melimato.com/pureftp-mysql-with-pure-uploadscript-functionallity/</link>
		<comments>http://blog.melimato.com/pureftp-mysql-with-pure-uploadscript-functionallity/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 14:46:21 +0000</pubDate>
		<dc:creator>pablo</dc:creator>
				<category><![CDATA[ftp]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[pure-ftpd]]></category>
		<category><![CDATA[pure-uploadscript]]></category>
		<category><![CDATA[pureadmin]]></category>
		<category><![CDATA[pureftpd]]></category>

		<guid isPermaLink="false">http://blog.melimato.com/?p=154</guid>
		<description><![CDATA[First lets install pureftpd using apt-get: Install pureftpd with the MySQL backend: apt-get install pure-ftpd-mysql Since I like having different log files for different services I edit syslog.conf to separate ftp log files to specific one: vi /etc/syslog.conf Add these line at the end of the file: ftp.* /var/log/ftp Create the required file and restart [...]]]></description>
			<content:encoded><![CDATA[<p>First lets install pureftpd using apt-get:</p>
<p>Install pureftpd with the MySQL backend:</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-mysql</pre></div></div>

<p><span id="more-154"></span></p>
<p>Since I like having different log files for different services I edit syslog.conf to separate ftp log files to specific one:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>syslog.conf</pre></div></div>

<p>Add these line at the end of the file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ftp.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ftp</span></pre></div></div>

<p>Create the required file and restart sysklogd:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ftp</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>sysklogd restart</pre></div></div>

<p>Edit MySQL connection information for pureftpd user:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</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>db<span style="color: #000000; font-weight: bold;">/</span>mysql.conf</pre></div></div>

<p>Add or uncomment the following lines in the file. Don&#8217;t forget to change the user and password details.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">MYSQLSocket      <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>mysqld<span style="color: #000000; font-weight: bold;">/</span>mysqld.sock
MYSQLUser       pure-ftpd
MYSQLPassword   pure-ftpd_pass
MYSQLDatabase   pureftpd
MYSQLCrypt      cleartext
MYSQLGetPW      SELECT Password FROM <span style="color: #c20cb9; font-weight: bold;">users</span> WHERE <span style="color: #007800;">User</span>=<span style="color: #ff0000;">&quot;\L&quot;</span>
MYSQLGetUID     SELECT Uid FROM <span style="color: #c20cb9; font-weight: bold;">users</span> WHERE <span style="color: #007800;">User</span>=<span style="color: #ff0000;">&quot;\L&quot;</span>
MYSQLGetGID     SELECT Gid FROM <span style="color: #c20cb9; font-weight: bold;">users</span> WHERE <span style="color: #007800;">User</span>=<span style="color: #ff0000;">&quot;\L&quot;</span>
MYSQLGetDir     SELECT Dir FROM <span style="color: #c20cb9; font-weight: bold;">users</span> WHERE <span style="color: #007800;">User</span>=<span style="color: #ff0000;">&quot;\L&quot;</span>
MySQLTransactions On</pre></div></div>

<p>Some more configuration settings and pure-uploadscript setup:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> no <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>PAMAuthentication
<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> <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>CreateHomeDir
<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> <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>CallUploadScript
<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> <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>ChrootEveryone</pre></div></div>

<p>Edit PurFtpd&#8217;s common settings:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd-common</pre></div></div>

<p>Change / uncomment the following lines:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">STANDALONE_OR_INETD</span>=standalone
<span style="color: #007800;">VIRTUALCHROOT</span>=<span style="color: #c20cb9; font-weight: bold;">false</span>
<span style="color: #007800;">UPLOADSCRIPT</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>pure-ftpd<span style="color: #000000; font-weight: bold;">/</span>uploadscript
<span style="color: #007800;">UPLOADUID</span>=<span style="color: #000000;">0</span>
<span style="color: #007800;">UPLOADGID</span>=<span style="color: #000000;">0</span></pre></div></div>

<p>Create MySQL users, apply permissions for the details set on /etc/pure-ftpd/db/mysql.conf . Also create users table for PureFtpd web admin:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> pureftpd;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">SELECT</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">INSERT</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">UPDATE</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">DELETE</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">CREATE</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">ON</span> pureftpd<span style="color: #66cc66;">.*</span> <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'pure-ftpd'</span>@<span style="color: #ff0000;">'localhost'</span> <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'pure-ftpd_pass'</span>;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">SELECT</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">INSERT</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">UPDATE</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">DELETE</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">CREATE</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">ON</span> pureftpd<span style="color: #66cc66;">.*</span> <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'pure-ftpd'</span>@<span style="color: #ff0000;">'localhost.localdomain'</span> <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'pure-ftpd_pass'</span>;
<span style="color: #993333; font-weight: bold;">FLUSH</span> PRIVILEGES;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`users`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`User`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">32</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`Password`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">32</span><span style="color: #66cc66;">&#41;</span> character <span style="color: #993333; font-weight: bold;">SET</span> latin1 collate latin1_bin <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`Uid`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'14'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`Gid`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'5'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`Dir`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">128</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`QuotaFiles`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'500'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`QuotaSize`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'30'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`ULBandwidth`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'80'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`DLBandwidth`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'80'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`Ipaddress`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">15</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'*'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`Comment`</span> tinytext<span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`Status`</span> enum<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'0'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`ULRatio`</span> smallint<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`DLRatio`</span> smallint<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`User`</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">UNIQUE</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #ff0000;">`User`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`User`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>InnoDB <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>latin1</pre></div></div>

<p>Create uploadscript.sh referred on previous step:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># UPLOAD_SIZE  : the size of the file, in bytes.</span>
    <span style="color: #666666; font-style: italic;"># UPLOAD_PERMS : the permissions, as an octal value.</span>
    <span style="color: #666666; font-style: italic;"># UPLOAD_UID   : the uid of the owner.</span>
    <span style="color: #666666; font-style: italic;"># UPLOAD_GID   : the group the file belongs to.</span>
    <span style="color: #666666; font-style: italic;"># UPLOAD_USER  : the name of the owner.</span>
    <span style="color: #666666; font-style: italic;"># UPLOAD_GROUP : the group name the file belongs to.</span>
    <span style="color: #666666; font-style: italic;"># UPLOAD_VUSER : the full user name, or the virtual user name. (127 chars max)</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Do something useful</span></pre></div></div>

<p>Install the PureFTPd user manager:</p>
<p>1. Download the user manager for PureFtpd from <a href="http://machiel.generaal.net/index.php?subject=user_manager_pureftpd&#038;button=download">here</a><br />
2. Uncompress the file to a web accessible directory:<br />
3. Point your browser to the chosen directory and open the file install.php<br />
4. Follow the installation steps</p>
<p>And you&#8217;re done!</p>
<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/pureftp-mysql-with-pure-uploadscript-functionallity/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
