in FreeBSD

How to install virtual Ftp hosting with PureFTP on FreeBSD 10 : Part 1 – Setup

My friend who work as R & D for small company told me about new policy from their management. Every one must backup their work once in a week and that backup also include internet backup. Such solution like dropbox is not allowed since their management a bit worry about control. What if they need to conduct audit of their backup or see bad pattern from there. One of management person told him about FTP as alternative that located in vps. Since my friend never use ftp before he ask me to create demo for him. Not a big deal since I ever work with such solution, utilize pureftp as ftp server and mysql as database server where they store user information like directory, password etc. In this post I’ll use FreeBSD 10 as operating system.


I use Vultr as vps provider. In reality I should use their ‘strorage series‘ that utilize sata storage. But for demo purpose and speed access. I choose performance series.

How to install virtual Ftp hosting with PureFTP on FreeBSD 10 : choose storage series

Operating system

FreeBSD 10 x64 with latest patch (automatic freebsd-update using posti install) from vultr.

How to install virtual Ftp hosting with PureFTP on FreeBSD 10 : choose FreeBSD 64 bit

Server Size

In case you choose storage series you’ll get server that utilize 1 cpu, 512MB memory, 160 GB storage and 1000 GB transfer.

How to install virtual Ftp hosting with PureFTP on FreeBSD 10 : choose $5/mo server size. Get 1 cpu, 512MB memory, 160 GB storage and 1000 GB transfer

Since I use performance series I got 768MB memory, 15GB SSD storage.

Vultr provide 10 gigabit connectivity but for this demo purpose I choose standard connectivity.

Click Order will trigger installation process and you can only wait during that time.

After a while I can see login box and able to ssh to the sever.

# uname -a
FreeBSD freebsd-3883 10.0-RELEASE-p10 FreeBSD 10.0-RELEASE-p10 #0: Mon Oct 20 12:42:25 UTC 2014  amd64

Yes, got latest patch.

Checking disk space

# df -H

Filesystem            Size    Used   Avail Capacity  Mounted on
/dev/label/rootfs0     14G    853M     12G     7%    /
devfs                 1.0k    1.0k      0B   100%    /dev

Setting Hostname

From command line

# hostname -s

Check it

# hostname

For permanent hostname edit /etc/rc.donf

# ee /etc/rc.conf

Edit hostname section from

# Auto-Enabled NICs from pc-sysinstall
ifconfig_vtnet0=”inet netmask″
route_linklocal=”-net -interface vtnet0″

Into this

# Auto-Enabled NICs from pc-sysinstall
ifconfig_vtnet0=”inet netmask″
route_linklocal=”-net -interface vtnet0″

save. (press esc button followed by choose leave editor).

Setting timeout period for openssh, to prevent ‘Write failed: Broken pipe‘ message.

# ee /etc/ssh/sshd_config

ClientAliveInterval 30
ClientAliveCountMax 5

save and restart openssh server

# /etc/rc.d/sshd restart

Change message of the day display.

# ee /etc/motd

fill anything you want, I used to enter value for something simple like company name etc or you can use google. Look for ascii banner.

Or quick way

# echo ‘ftp server’>/etc/motd

Install Pureftp

Since I don’t know which option used if I choose pure-ftp by pkg command (mysql enable etc) then I choose ports for pure-ftp and the rest handled by pkg (to minimize compile process if needed).

# portsnap fetch

# portsnap extract

# cd /usr/ports/ftp/pure-ftpd/

# make install

All options available for pure-ftpd, I choose : Docs, examples, MySQL, PAM, Privsep, sendfile, TLS, uploadscript and virtualchroot.

install pure-ftp on freeebsd 10 : Docs, examples, MySQL, PAM, Privsep, sendfile, TLS, uploadscript and virtualchroot.

Hit OK and let installer work. The rest of confirmation is yours, just accept default values.

After you see # sign, check what’s installed with this command :

# pkg info

ca_root_nss-3.17.2             The root certificate bundle from the Mozilla Project
cmake-3.0.2                    Cross-platform Makefile generator
cmake-modules-3.0.2            Modules and Templates for CMake
curl-7.38.0_2                  Non-interactive tool to get files from FTP, GOPHER, HTTP(S) servers
dialog4ports-0.1.5_2           Console Interface to configure ports
expat-2.1.0_1                  XML 1.0 parser written in C
gettext-             GNU gettext package
indexinfo-0.2                  Utility to regenerate the GNU info page index
mysql55-client-5.5.40          Multithreaded SQL database (client)
perl5-5.16.3_11                Practical Extraction and Report Language
pkg-1.3.8_3                    Package manager
pkgconf-0.9.7                  Utility to help to configure compiler and linker flags
pure-ftpd-1.0.36_3             Small, easy to set up, fast, and secure FTP server
py27-Babel-1.3_2               Collection of tools for internationalizing Python applications
py27-Jinja2-2.7.3              Fast and easy to use stand-alone template engine
py27-MarkupSafe-0.23           Implements a XML/HTML/XHTML Markup safe string for Python
py27-docutils-0.12             Python Documentation Utilities
py27-pygments-1.6_2            Syntax highlighter written in Python
py27-pytz-2014.7,1             World Timezone Definitions for Python
py27-setuptools27-5.5.1        Python packages installer
py27-sphinx-1.2.3              Python documentation generator
python27-2.7.8_5               Interpreted object-oriented programming language

note : in case you want to speed installation process you can install others as package then  followed by pure-ftpd from ports.

ex :

# pkg install ca_root_nss cmake cmake-modules curl dialog4ports expat gettext indexinfo mysql55-client perl5 pkgconf py27-Babel py27-Jinja2 py27-MarkupSafe py27-docutils py27-pygments py27-pytz py27-setuptools27 py27-sphinx python27

# cd /usr/ports/ftp/pure-ftpd/ && make install

Configure Pure-ftpd

Enable the service first

# echo 'pureftpd_enable=YES' >>/etc/rc.conf

Create configuration file

# cp /usr/local/etc/pure-ftpd.conf.sample /usr/local/etc/pure-ftpd.conf

Start Service

# /usr/local/etc/rc.d/pure-ftpd start

Starting pureftpd.
Running: /usr/local/sbin/pure-ftpd -g/var/run/ -A -c50 -B -C8 -D -fftp -H -I15 -L10000:8 -m4 -s -U133:022 -u100 -k99 -Z

Check the service

# ps ax | grep ftp

77338  –  Is     0:00.00 pure-ftpd (SERVER) (pure-ftpd)

At this stage pure-ftp installed successfully.  In next post I’ll show how to test ftp service from client and how to configure and enable TLS support for this FTP server.

Stay tune and happy weekend.