Coder Social home page Coder Social logo

proftpd-mysql's Introduction

ProFTPD-MySQL

ProFTPD Base Image including MySQL database authentication support.

DockerHub

This is available on DockerHub under the cyberduck/proftpd-mysql image name.

Usage

Example of running the image for one single standard FTP user using docker-compose:

version: '2'
services:
    ftp:
        image: cyberduck/proftpd-mysql
        environment:
            FTP_USERNAME: ftp_user_name
            FTP_PASSWORD: ftp_user_password
        volumes:
            - /path/to/ftp/folder:/home/ftp_user_name
        networks:
            - some_network_name
        ports:
            - "21:21"
            - "20:20"
            - "60000-60100:60000-60100"

Example of running the image for a MySQL database authentication using docker-compose:

version: '2'
services:
    ftp:
        image: cyberduck/proftpd-mysql
        environment:
            MYSQL_HOST: mysql_host_address
            MYSQL_DATABASE: mysql_database_name
            MYSQL_USER: mysql_username
            MYSQL_PASSWORD: mysql_password
            PROFTPD_USER: proftpd
            WEB_GROUP: www-data
        volumes:
            - /path/to/ftp/folder:/path/to/ftp/folder
        networks:
            - some_network_name
        ports:
            - "21:21"
            - "20:20"
            - "60000-60100:60000-60100"

MySQL Tables to generate

CREATE TABLE IF NOT EXISTS `ftp_groups` (
    `group_name` varchar(16) COLLATE utf8_general_ci NOT NULL,
    `gid` smallint(6) NOT NULL DEFAULT '5500',
    `members` varchar(16) COLLATE utf8_general_ci NOT NULL,
    KEY `group_name` (`group_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
CREATE TABLE IF NOT EXISTS `ftp_users` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `user_name` varchar(32) COLLATE utf8_general_ci NOT NULL DEFAULT '',
    `password` varchar(32) COLLATE utf8_general_ci NOT NULL DEFAULT '',
    `uid` smallint(6) NOT NULL DEFAULT '5500',
    `gid` smallint(6) NOT NULL DEFAULT '5500',
    `home_directory` varchar(255) COLLATE utf8_general_ci NOT NULL DEFAULT '',
    `shell` varchar(16) COLLATE utf8_general_ci NOT NULL DEFAULT '/sbin/nologin',
    `count` int(11) NOT NULL DEFAULT '0',
    `accessed_at` timestamp NULL,
    `modified_at` timestamp NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `userid` (`user_name`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

Password generation

This image supports both OpenSSL and Crypt for password encryption.

Crypt is the one used when the MySQL function PASSWORD() is used.

To generate a password for OpenSSL please use the following:

echo -n "your_password" | openssl dgst -binary -md5 | openssl enc -base64

User and Group customization

If you would like to change the user and group the ProFTPD service/server is running as, you can use the following environment variables :

  • PROFTPD_USER (default is set to nobody)
  • WEB_GROUP (default is set to nobody)

Test it

You can use your favourite FTP client (such as FileZilla) to connect to the server with the sample user you added before.

You can also run ftp localhost from your macOS host machine for example.

Troubleshooting

You can view the log files of ProFTPD itself:

tail -f /var/log/proftpd/proftpd.log

And the SQL part of ProFTPD:

tail -f /var/log/proftpd/sql.log

proftpd-mysql's People

Contributors

clemblanco avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.