ProFTPD on Mac OS X 10.4 with MySQL 5.0 back-end
How to install and configure ProFTPD on Mac OS X 10.4 with MySQL 5.0 back-end.

ProFTPD on Mac OS X 10.4 with MySQL 5.0 back-end.


Step1 - Mac OS X Developer Tools
Once you have finished to install Mac OS X 10.4 and done all System Updates, you have to install Mac OS X Developer Tools.
You can find Developer Tools package on the Installation DVD or download it at this address:
Admin password required for the installation.
Reboot your server.


Step2 - MySQL 5.0
Install MySQL 5.0 is very easy, you have to visit this address:
Download the right version for your server [ Mac OS X 10.4 (PowerPC, 32-bit), Mac OS X 10.4, (PowerPC, 64-bit) or Mac OS X 10.4 (x86) ]
Mount the dmg and install the package.
Then drag the PrefPane over the System Preferences icon on your Dock.


Step3 - ProFTPD
Download ProFTPD on your desktop from this address:
Untar the package and rename the folder to "proftpd", then open a Terminal shell.

cd /Users/your_user/Desktop/proftpd/
./configure --with-modules=mod_sql:mod_sql_mysql --with-includes=/usr/local/mysql/include --with-libraries=/usr/local/mysql/lib
make install


Step4 - Create MySQL Table for ProFTPD
We suggest you to install PhpMyAdmin, downloadable from this address:
You have to execute some SQL commands and create the database and the table where you will insert your FTP Users.

Create the database and call it "proftpd".
Then create the table using the "create table command" that follow.

# Database : `proftpd`

# --------------------------------------------------------

# Table structure for table `ftpusers`

CREATE TABLE `ftpusers` (
`loginallowed` char(1) NOT NULL default 'Y',
`username` varchar(60) NOT NULL default 'NULL',
`uid` int(11) unsigned default '1000',
`gid` int(11) unsigned default '1000',
`groupname` varchar(50) default 'ftp',
`password` varchar(30) default 'NULL',
`homedir` varchar(255) default '/Users/ftp/default/',
`shell` varchar(15) NOT NULL default '/sbin/nologin',
`count` int(11) unsigned default '0',
`fretr` int(10) unsigned default '0',
`bretr` int(10) unsigned default '0',
`bstor` int(10) unsigned default '0',
`fstor` int(10) unsigned default '0',
`ftime` timestamp(14) NOT NULL,
`faddr` varchar(255) default 'NULL',
`fhost` varchar(255) default 'NULL',
`fcdir` varchar(255) default 'NULL',
PRIMARY KEY (`username`)

Now you have to create a new MySQL User to use with the ProFTPD configuration.
For example: mysql_proftpd

Step5 - Configure proftpd.conf
Before you start to configure ProFTPD, you have to create a new System User, creating a new account.
For example: macosx_proftpd
Now you have to configure ProFTPD editing the configuration file.

sudo pico /usr/local/etc/proftpd.conf

This is a configuration example:

# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use. It establishes a single server
# and a single anonymous login. It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.

ServerName "FTP Kdev"
ServerType standalone
DefaultServer on
UseReverseDNS off
IdentLookups off
SystemLog /var/log/proftp

# Port 21 is the standard FTP port.
Port 21
PassivePorts 60000 65535

# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022

# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances 30

# Set the user and group under which the server will run.
User macosx_proftpd
Group macosx_proftpd

SQLAuthenticate on
SQLUserInfo ftpusers username password NULL NULL homedir shell
SQLAuthTypes Plaintext Backend
SQLConnectInfo mysql_proftpd@localhost:3306 mysql_proftpd mysql_proftpd(password)
SQLUserWhereClause "LoginAllowed = 'Y'"
SQLDefaultGID 70
SQLDefaultUID 70
SQLGroupInfo ftpusers groupname gid username
SQLHomedirOnDemand on
SQLDefaultHomedir /ftp/default
#SQLDefaultHomedir homedir
SQLLog PASS updatelogin
SQLNamedQuery updatelogin UPDATE "count=count+1 WHERE username='%u'" ftpusers

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~

# Normally, we want files to be overwriteable.
AllowOverwrite on

# Bar use of SITE CHMOD by default

# A basic anonymous configuration, no upload directories. If you do not
# want anonymous users, simply delete this entire <Anonymous> section.
<Anonymous ~ftp>
User macosx_proftpd
Group macosx_proftpd

# We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias anonymous ftp

# Limit the maximum number of anonymous logins
MaxClients 10

# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
DisplayLogin welcome.msg
DisplayFirstChdir .message

# Limit WRITE everywhere in the anonymous chroot
<Limit WRITE>

Step6 - Create the StartupItem
In order to automatically start the ProFTPD Service at the boot you have to create a StartupItem.
You have to create the directory for ProFTPD.

cd /Library/StartupItems/
mkdir ProFTPD

And iside this directory you have to create StartupParameters.plist

pico StartupParameters.plist

With this contents.

Description = "FTP server";
Provides = ("ProFTPD");
Messages =
start = "Starting ProFTPD service";
stop = "Stopping ProFTPD service";

And the file ProFTPD.

pico ProFTPD

With this contents.


# Start ProFTPD
. /etc/rc.common

StartService ()
ConsoleMessage "Starting ProFTPD server"

StopService ()
ConsoleMessage "Stopping ProFTPD server"
A=`ps -ax | grep proftpd | awk {'print $1'} | head -1`
kill -9 $A

RunService "$1"

Then change tje privileges of the folder.

chown -R root:wheel ProFTPD/


Step7 - sbin nologin
Finally edit the shells file.

sudo pico /etc/shells

And add /sbin/nologin at the end of he file.

# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.