Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

NanoFTPd FTP Server with MogileFS Backend

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 contrib
Octocat-spinner-32 docs
Octocat-spinner-32 lib
Octocat-spinner-32 log
Octocat-spinner-32 modules
Octocat-spinner-32 tmp
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README
Octocat-spinner-32 config.php
Octocat-spinner-32 nanoftpd.php
Octocat-spinner-32 users
README
mogilefs-ftpd
=============

This is a FTP daemon based on nanoftpd written in PHP. It has a MogileFS
backend that uses the MogileFS PECL extension.

Basic upload, download, deletion is possible but not all FTP commands can be
translated to MogileFS command (eg. chmod).

The original nanoftpd version has been modified to be multi process capable
and some unmaintained code has been removed.

This is production safe quality software and we used it several month while
migrating to MogileFS.

Author: Andre Pascha <bender@duese.org>

Original Nanoftpd Site: http://nanoftpd.sourceforge.net/
Original Nanoftpd Authors:
Arjen <arjenjb@wanadoo.nl>
Phanatic <linux@psoftwares.hu>

Installation
============
You need at least PHP 5.2.6 and these PHP extensions to run mogilefs-ftpd:

* sockets 
* pcntl
* posix
* PECL MogileFS (>= 0.9.1) (https://pecl.php.net/mogilefs)
* PECL proctitle (optional)

There is a logrotate config and a init script available in the contrib
directory.

Configuration
=============
adjust values in config.php and start the deamon. 

mogilefs->listlimit = 1000;
limit of the list returned by LIST command. Set as low as possible for best
performance. :)

mogilefs->extendedlist = true;
this will enable meta data lookup for every file in the LIST output. If you
don't need the file length in the output, let this off to avoid lookups and
speed up listing.

mogilefs->searchlist = true;
allow you to search mogilefs files via LIST <search prefix>. So LIST test will
search for any files matching <class>/test*.

mogilefs->canrename = true;	
allow rename commands to be translated into MogileFS commands. 

mogilefs->canmkdir = true;
on mkdir command create a MogileFS class with the given directory name.

mogielfs->canrmdir = true;
on rmdir command delete a MogileFS class with the given directory name. 

mogilefs->mindevcount = 2;
mindevcount parameter for creating MogileFS classes.

mogilefs->defaultclass = "default";
mogilefs class to use when when uploading files in MogileFs_FlatNS.


IO Modules
==========
There is an IO module interface defined in modules/Io/Interface.php. You can
implement your own modules and plug them into nanoftpd. There are some modules
in modules/Io to illustrate what you can do with it.

Io_File
Basic file backend. No MogileFS Support. 

Io_MogileFs
MogileFs Backend where the first directory level represents the MogileFs
classes. MogileFs filenames are always prefixed by the current class. 

Io_MogileFs_FlatNS
MogileFs Backend with flat namespace. All files get listed into the root
directory. MogileFs class is taken from mogilefs->defaultclass when uploading
files.

Io_MogileFs_DomainNS
MogileFs Backend with domain namespace. First directory level represents the
MogileFs domains and the second the corresponding classes. 

Io_MogileFs_UserDomain
MogileFs Backend where the logged in user is used as the MogileFS Domain.


Auth Modules
============
You can create authentication plugins. Check the interface definition at 
modules/Auth/Interface.php. Currently only one module is implemented which
used a text based user database.


Hints
=====
1. default path convention is <mogilefs class>/<filename>. If your MogileFS is not
using this convention you can still use this module but you may have to 
adjust io_mogilfs.php.

2. PHP error logs go to log/nanoftpd.err. Application logs go to
log/nanoftpd.log

3. password for the shipped users in users text database is 'test'.

4. when listing files in classes there is a limit for the list.  If you have 
a large MogileFS class it doesn't really makes sense to list millions of 
files (tough it is possible if you adjust the listlimit).

5. MKD command can create MogileFS classes and RMD can delete them. 

6. you can even rename files in MogileFS using the RNFR RNTO commands.


Compatibility
=============
Used to work with:
* PHP FTP extension of PHP 5.2.6 
* FileZilla 3.3.5.1 on Ubuntu
* Cyberduck Version 4.0.2 (8601) on MacOS X
Something went wrong with that request. Please try again.