<?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>Michael Kolb Fulda&#187; Web Engineering</title>
	<atom:link href="http://www.michael-kolb.co.uk/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.michael-kolb.co.uk</link>
	<description>Web Engineering</description>
	<lastBuildDate>Mon, 01 Mar 2010 05:58:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ProFTPd authentification with MySQL</title>
		<link>http://www.michael-kolb.co.uk/webhosting/proftpd-authentification-with-mysql/</link>
		<comments>http://www.michael-kolb.co.uk/webhosting/proftpd-authentification-with-mysql/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 07:06:11 +0000</pubDate>
		<dc:creator>mk_michael</dc:creator>
				<category><![CDATA[Linux Daemons]]></category>
		<category><![CDATA[Webhosting]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.michael-kolb.co.uk/?p=69</guid>
		<description><![CDATA[It&#8217;s very helpful to use the mysql authentification for proftpd. Especially if you manage a quite number of users. So you&#8217;re able to use a central database which manages the accounts.



First thing you need is an appropriate mysql schema that belongs your needs. This is my example:

CREATE TABLE ftp_users (
  username varchar(60) binary default [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s very helpful to use the <a href="http://www.michael-kolb.co.uk/tag/mysql">mysql</a> authentification for proftpd. Especially if you manage a quite number of users. So you&#8217;re able to use a central database which manages the accounts.</p>
<p><img class="size-medium wp-image-202 aligncenter"  src="http://www.michael-kolb.co.uk/wp-content/uploads/2008/12/proftpd.jpg" alt="proftpd with mysql" title="proftpd with mysql" width="301" height="241" class="alignnone size-medium wp-image-505" /></p>
<p><span id="more-69"></span></p>
<p>
First thing you need is an appropriate <a href="http://www.michael-kolb.co.uk/tag/mysql">mysql</a> schema that belongs your needs. This is my example:<br />
<br />
<code>CREATE TABLE ftp_users (<br />
  username varchar(60) binary default NULL,<br />
  uid int(11) default NULL,<br />
  gid int(11) default NULL,<br />
  password varchar(30) default NULL,<br />
  homedir varchar(250) default NULL,<br />
  count int(11) default NULL,<br />
  ui bigint(20) NOT NULL auto_increment,<br />
  shell varchar(60) default NULL,<br />
  last datetime default NULL,<br />
  allow char(1) default NULL,<br />
  PRIMARY KEY  (ui)<br />
) TYPE=ISAM PACK_KEYS=1;<br />
<br />
CREATE TABLE xfer_stat (<br />
  username tinytext,<br />
  filename text,<br />
  size bigint(20) default NULL,<br />
  host tinytext,<br />
  ip tinytext,<br />
  action tinytext,<br />
  durability tinytext,<br />
  local_time datetime default NULL,<br />
  success char(1) default NULL,<br />
  ui bigint(20) NOT NULL auto_increment,<br />
  PRIMARY KEY  (ui)<br />
) TYPE=MyISAM;<br />
</code></p>
<p>
Be sure to have installed all required <a href="http://www.michael-kolb.co.uk/tag/linux/">linux</a> packages:<br />
</p>
<p><code>apt-get -y install mysql-client-5.0<br />
apt-get -y install mysql-server-5.0<br />
apt-get -y install mysql-common<br />
apt-get -y install proftpd-mysql</code></p>
<p>Last thing to do is adapting the /etc/proftpd.conf for acessing <a href="http://www.michael-kolb.co.uk/tag/mysql">mysql</a> tables. You will find the lines at end of the configuration file. Please insert your passwords:</p>
<p><code><br />
DefaultRoot ~<br />
RequireValidShell off<br />
<br />
SQLAuthTypes            Plaintext Crypt<br />
SQLAuthenticate         users* groups*<br />
SQLConnectInfo          mysqluser@127.0.0.1 mysqluser mysqlpassword<br />
SQLUserInfo               ftp_users username password uid gid homedir shell<br />
SQLGroupInfo             ftp_groups groupname gid members<br />
SQLUserWhereClause      "login_enabled = 'Y'"<br />
<br />
SQLLogFile /var/log/ftp/proftpd.sql.log<br />
<br />
SQLLog PASS login<br />
SQLNamedQuery login UPDATE "last_login=now(), login_count=login_count+1 WHERE username='%u'" ftp_users<br />
<br />
SQLLog RETR download<br />
SQLNamedQuery download UPDATE "down_count=down_count+1, down_bytes=down_bytes+%b WHERE username='%u'" ftp_users<br />
<br />
SQLLog STOR upload<br />
SQLNamedQuery upload UPDATE "up_count=up_count+1, up_bytes=up_bytes+%b WHERE username='%u'" ftp_users<br />
</code></p>
<p>Helpful link:<br />
<a href="http://www.proftpd.de/HowTo-SQL.29.0.html" target="_blank">http://www.proftpd.de/HowTo-SQL.29.0.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.michael-kolb.co.uk/webhosting/proftpd-authentification-with-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
